@iankibetsh/vue-streamline 1.2.0 → 1.2.2
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 +22 -4
- package/package.json +1 -1
- package/src/App.vue +3 -0
- package/src/composables/useStreamline.js +5 -0
package/README.md
CHANGED
|
@@ -32,11 +32,19 @@ Vue.use(streamline, {
|
|
|
32
32
|
import { useStreamline } from '@iankibet/vue-streamline'
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
const {getActionUrl, service:tasksService} = useStreamline('tasks')
|
|
35
|
+
const {getActionUrl, service:tasksService, props} = useStreamline('tasks')
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Calling an action/method in the service
|
|
40
|
+
|
|
41
|
+
You can call an action/method in the service by calling the method on the service object
|
|
42
|
+
```js
|
|
43
|
+
const res = await tasksService.getTasks()
|
|
44
|
+
|
|
45
|
+
// or
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
tasksService.getTasks().then(response => {
|
|
40
48
|
console.log(response)
|
|
41
49
|
})
|
|
42
50
|
```
|
|
@@ -47,4 +55,14 @@ tasksServices.getTasks().then(response => {
|
|
|
47
55
|
You can get the url to an action/method in the service by calling the getActionUrl method on the service object passing the action name and any parameters
|
|
48
56
|
```js
|
|
49
57
|
getActionUrl('getTasks', 'active')
|
|
50
|
-
```
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Accessing class properties
|
|
61
|
+
In your template just access the props object to get the class properties
|
|
62
|
+
```html
|
|
63
|
+
<template>
|
|
64
|
+
<div>
|
|
65
|
+
<h1>{{props.title}}</h1>
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
```
|
package/package.json
CHANGED
package/src/App.vue
CHANGED
|
@@ -23,6 +23,9 @@ const findPaybill = async ()=>{
|
|
|
23
23
|
<hr/>
|
|
24
24
|
<h3>Destructed: {{ testKey }}</h3>
|
|
25
25
|
<h3>Original: {{ props.testKey }}</h3>
|
|
26
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
27
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
28
|
+
<h3>Original: {{ props.testKey }}</h3>
|
|
26
29
|
<h3 class="text-success" >Loading : {{ loading }}</h3>
|
|
27
30
|
<h1 @click="findPaybill">Get Paybill</h1>
|
|
28
31
|
{{ foundPaybill }}
|
|
@@ -64,6 +64,11 @@ const useStreamline = (stream, ...initialArgs) => {
|
|
|
64
64
|
|
|
65
65
|
const handler = {
|
|
66
66
|
get(target, prop, receiver) {
|
|
67
|
+
// Fetch properties if not already fetched
|
|
68
|
+
if (!propertiesFetched.value && !loading.value) {
|
|
69
|
+
fetchServiceProperties().then(() => target[prop]);
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
// Handle existing properties
|
|
68
73
|
if (prop in target) {
|
|
69
74
|
return target[prop];
|