@@ -33,12 +33,12 @@ yarn add vue-ray
33
33
34
34
When using in a Vue 3.x project (the default), import package normally:
35
35
36
- ``` js
36
+ ``` js
37
37
import { createApp } from ' vue' ;
38
38
import App from ' ./App.vue' ;
39
39
40
40
// as an es module import:
41
- import RayPlugin from ' vue-ray' ;
41
+ import { RayPlugin } from ' vue-ray' ;
42
42
43
43
// or as a commonjs import:
44
44
const { RayPlugin } = require (' vue-ray' );
@@ -52,11 +52,11 @@ app.use(RayPlugin, { interceptErrors: true, port: 23500, showComponentEvents: ['
52
52
53
53
When using in a Vue 2.x project, import the 'vue2' variant:
54
54
55
- ``` js
55
+ ``` js
56
56
const Vue = require (' vue' );
57
57
58
58
// as an es module import:
59
- import RayPlugin from ' vue-ray/vue2' ;
59
+ import { RayPlugin } from ' vue-ray/vue2' ;
60
60
61
61
// or as a commonjs import:
62
62
const { RayPlugin } = require (' vue-ray/vue2' );
@@ -66,24 +66,24 @@ Vue.use(RayPlugin, { interceptErrors: true, host: '127.0.0.1', showComponentEven
66
66
67
67
### Installation options
68
68
69
- | Name | Type | Default | Description |
70
- | --- | --- | --- | --- |
71
- | ` host ` | ` string ` | ` localhost ` | host to connect to the Ray app on |
72
- | ` interceptErrors ` | ` boolean ` | ` false ` | send Vue errors to Ray |
73
- | ` port ` | ` number ` | ` 23517 ` | port to connect to the Ray app on |
74
- | ` showComponentEvents ` | ` string[] ` | ` [] ` | display component events in Ray, see below for possible values |
69
+ | Name | Type | Default | Description |
70
+ | --------------------- | ---------- | ----------- | ----------------------------------------------------------- --- |
71
+ | ` host ` | ` string ` | ` localhost ` | host to connect to the Ray app on |
72
+ | ` interceptErrors ` | ` boolean ` | ` false ` | send Vue errors to Ray |
73
+ | ` port ` | ` number ` | ` 23517 ` | port to connect to the Ray app on |
74
+ | ` showComponentEvents ` | ` string[] ` | ` [] ` | display component events in Ray, see below for possible values |
75
75
76
76
### Component events
77
77
78
78
Component lifecycle events can be sent to Ray using the ` showComponentEvents ` plugin option _ (` array ` )_ .
79
79
80
80
Any or all of the following values can be used with this option:
81
81
82
- - ` before-create `
83
- - ` before-mount `
84
- - ` created `
85
- - ` mounted `
86
- - ` updated `
82
+ - ` before-create `
83
+ - ` before-mount `
84
+ - ` created `
85
+ - ` mounted `
86
+ - ` updated `
87
87
88
88
## Usage
89
89
@@ -93,12 +93,12 @@ See the [node-ray reference](https://github.com/permafrost-dev/node-ray#referenc
93
93
94
94
## Vue-specific methods
95
95
96
- | Name | Description |
97
- | --- | --- |
98
- | ` this.$ray().data() ` | show the component data |
99
- | ` this.$ray().props() ` | show the component props |
100
- | ` this.$ray().ref(name) ` | show the ` innerHTML ` of a named ref |
101
- | ` this.$ray().track(name) ` | display changes to a component's data variable |
96
+ | Name | Description |
97
+ | --------------------------- | --------------------------------------------------- --- |
98
+ | ` this.$ray().data() ` | show the component data |
99
+ | ` this.$ray().props() ` | show the component props |
100
+ | ` this.$ray().ref(name) ` | show the ` innerHTML ` of a named ref |
101
+ | ` this.$ray().track(name) ` | display changes to a component's data variable |
102
102
| ` this.$ray().untrack(name) ` | stop displaying changes to a component's data variable |
103
103
104
104
## Tracking component data
@@ -120,9 +120,11 @@ export default {
120
120
this.$ray().track('one');
121
121
},
122
122
mounted() {
123
- setInterval( () => { this.one += 3; }, 4000);
124
- }
125
- }
123
+ setInterval(() => {
124
+ this.one += 3;
125
+ }, 4000);
126
+ },
127
+ };
126
128
</script>
127
129
```
128
130
@@ -188,31 +190,31 @@ Vue.use(RayPlugin, { interceptErrors: true });
188
190
189
191
In either a Vue 2.x or 3.x project, you may use the ` vue-ray ` vuex plugin - it can track the vuex state, log mutations and log actions.
190
192
191
- To use it, import the ` RayVuexPlugin ` function from ` vue-ray ` _ ( ` vue-ray/vue2 ` for Vue 2) _ , and pass the result of the function to the ` plugins ` property on your Vuex store:
193
+ To use it, import the ` RayVuexPlugin ` function from ` vue-ray ` , and pass the result of the function to the ` plugins ` property on your Vuex store:
192
194
193
195
``` js
194
196
// ...
195
197
196
- import { RayVuexPlugin } from ' vue-ray' ; // or ' vue-ray/vue2' if using Vue 2.x
198
+ import { RayVuexPlugin } from ' vue-ray' ; // for both vue 2 and vue 3
197
199
198
200
// ...
199
201
200
202
const storeObj = {
201
- state: {
202
- one: 11 ,
203
- two: 22 ,
204
- },
205
- mutations: {
206
- incrementOne (state ) {
207
- state .one += 1 ;
203
+ state: {
204
+ one: 11 ,
205
+ two: 22 ,
208
206
},
209
- incrementTwo (state ) {
210
- state .two += 2 ;
207
+ mutations: {
208
+ incrementOne (state ) {
209
+ state .one += 1 ;
210
+ },
211
+ incrementTwo (state ) {
212
+ state .two += 2 ;
213
+ },
211
214
},
212
- },
213
- actions: {},
214
- modules: {},
215
- plugins: [RayVuexPlugin ({trackState: true , logMutations: true })],
215
+ actions: {},
216
+ modules: {},
217
+ plugins: [RayVuexPlugin ({ trackState: true , logMutations: true })],
216
218
};
217
219
218
220
// Vue 3:
@@ -224,25 +226,25 @@ export default new Vuex.Store(storeObj);
224
226
225
227
### Vuex plugin options
226
228
227
- | Name | Type | Description |
228
- | --- | --- | --- |
229
- | ` trackState ` | ` boolean ` | track the data in the store's state |
230
- | ` logMutations ` | ` boolean ` | log all fired mutations to Ray |
231
- | ` logActions ` | ` boolean ` | log all fired actions to Ray |
232
- | ` loggedMutationColor ` | ` string ` | send logged mutations with the specified Ray color |
233
- | ` loggedActionColor ` | ` string ` | send logged actions with the specified Ray color |
229
+ | Name | Type | Description |
230
+ | --------------------- | --------- | ----------------------------------------------- --- |
231
+ | ` trackState ` | ` boolean ` | track the data in the store's state |
232
+ | ` logMutations ` | ` boolean ` | log all fired mutations to Ray |
233
+ | ` logActions ` | ` boolean ` | log all fired actions to Ray |
234
+ | ` loggedMutationColor ` | ` string ` | send logged mutations with the specified Ray color |
235
+ | ` loggedActionColor ` | ` string ` | send logged actions with the specified Ray color |
234
236
235
237
Valid color names are ` blue ` , ` gray ` , ` green ` , ` orange ` , ` purple ` , ` red ` , and ` none ` .
236
238
237
239
## Development setup
238
240
239
- - ` npm install `
240
- - ` npm run test `
241
- - ` npm run build:all `
241
+ - ` npm install `
242
+ - ` npm run test `
243
+ - ` npm run build:all `
242
244
243
245
## Testing
244
246
245
- ` vue-ray ` uses Jest for unit tests. To run the test suite:
247
+ ` vue-ray ` uses Jest for unit tests. To run the test suite:
246
248
247
249
` npm run test `
248
250
@@ -262,8 +264,8 @@ Please review [our security policy](../../security/policy) on how to report secu
262
264
263
265
## Credits
264
266
265
- - [ Patrick Organ] ( https://github.com/patinthehat )
266
- - [ All Contributors] ( ../../contributors )
267
+ - [ Patrick Organ] ( https://github.com/patinthehat )
268
+ - [ All Contributors] ( ../../contributors )
267
269
268
270
## License
269
271
0 commit comments