@iankibetsh/vue-streamline 1.2.7 → 1.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -1
- package/package.json +1 -1
- package/src/composables/useStreamline.js +19 -2
package/README.md
CHANGED
|
@@ -66,7 +66,22 @@ getActionUrl('getTasks', 'active')
|
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
## Accessing class properties
|
|
69
|
-
|
|
69
|
+
You can access the class properties defined in the service class using the props object returned by the useStreamline function
|
|
70
|
+
### In your script
|
|
71
|
+
Access the props object to get the class properties, use computed to make it reactive
|
|
72
|
+
```js
|
|
73
|
+
const title = computed(() => props.title)
|
|
74
|
+
```
|
|
75
|
+
Then use it in your template
|
|
76
|
+
```html
|
|
77
|
+
<template>
|
|
78
|
+
<div>
|
|
79
|
+
<h1>{{title}}</h1>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
```
|
|
83
|
+
### Directly in your template
|
|
84
|
+
In your template just access the props object to get the class properties. Prefer using computed to make it reactive
|
|
70
85
|
```html
|
|
71
86
|
<template>
|
|
72
87
|
<div>
|
package/package.json
CHANGED
|
@@ -108,14 +108,31 @@ const useStreamline = (stream, ...initialArgs) => {
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
const getActionUrl = (action, ...args) => {
|
|
111
|
-
|
|
111
|
+
let newStream = stream
|
|
112
|
+
if(action.includes(':')){
|
|
113
|
+
[newStream, action] = action.split(':')
|
|
114
|
+
}
|
|
112
115
|
const post = {
|
|
113
116
|
action,
|
|
114
|
-
stream,
|
|
117
|
+
stream:newStream,
|
|
115
118
|
params: args
|
|
116
119
|
}
|
|
117
120
|
return `${streamlineUrl}?${new URLSearchParams(post).toString()}`
|
|
121
|
+
|
|
122
|
+
// // Add each arg as a separate param
|
|
123
|
+
// args.forEach((arg, index) => {
|
|
124
|
+
// let value = arg;
|
|
125
|
+
// if (typeof arg === 'object' && !(arg instanceof Date)) {
|
|
126
|
+
// value = JSON.stringify(arg);
|
|
127
|
+
// } else if (arg instanceof Date) {
|
|
128
|
+
// value = arg.toISOString();
|
|
129
|
+
// }
|
|
130
|
+
// params.append(`params[${index}]`, value);
|
|
131
|
+
// })
|
|
132
|
+
|
|
133
|
+
// return `${streamlineUrl}?${params.toString()}`
|
|
118
134
|
}
|
|
135
|
+
|
|
119
136
|
const service = reactive({})
|
|
120
137
|
|
|
121
138
|
// Confirmation wrapper
|