Skip to content

Commit be284fd

Browse files
committed
Add template for url
1 parent c73fc13 commit be284fd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/interface.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
:class="[trigger.type]"
88
:loading="loadings[index].value"
99
v-bind="{ [trigger.size]: true }"
10-
@click="onClick(trigger.method, trigger.url, index)"
10+
@click="onClick(trigger.method, parsedUrls[index], index)"
1111
>
1212
{{ trigger.label }}
1313
</v-button>
1414
</div>
1515
</template>
1616

1717
<script lang="ts">
18-
import { defineComponent, PropType, ref } from 'vue';
18+
import { computed, defineComponent, inject, PropType, ref } from 'vue';
1919
import { useApi, useStores } from '@directus/extensions-sdk';
20+
import { render } from 'micromustache';
2021
2122
type Trigger = {
2223
label: string;
@@ -43,9 +44,12 @@ export default defineComponent({
4344
const { useNotificationsStore } = useStores();
4445
const store = useNotificationsStore();
4546
47+
const values = inject('values', ref<Record<string, any>>({}));
48+
const parsedUrls = computed(() => props.triggers.map((trigger) => render(trigger.url ?? '', values.value)));
49+
4650
const loadings = props.triggers.map(() => ref(false));
4751
48-
return { loadings, onClick };
52+
return { loadings, parsedUrls, onClick };
4953
5054
async function onClick(method: string, url: string, index: number) {
5155
const loading = loadings[index];

0 commit comments

Comments
 (0)