use immediate: true for watch
This commit is contained in:
parent
ebfe2162e9
commit
6ffbabeedc
1 changed files with 3 additions and 2 deletions
|
@ -19,7 +19,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const MkUrlPreview = defineAsyncComponent(() => import('@/components/url-preview.vue'));
|
const MkUrlPreview = defineAsyncComponent(() => import('@/components/url-preview.vue'));
|
||||||
|
|
||||||
let text: string = $ref(props.hpml.interpolate(props.block.text) ?? '');
|
let text: string = $ref('');
|
||||||
|
|
||||||
const urls = computed((): string[] => {
|
const urls = computed((): string[] => {
|
||||||
if (text) {
|
if (text) {
|
||||||
|
@ -30,9 +30,10 @@ const urls = computed((): string[] => {
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(props.hpml.vars, () => {
|
watch(props.hpml.vars, () => {
|
||||||
text = props.hpml.interpolate(props.block.text) ?? '';
|
text = props.hpml.interpolate(props.block.text) as string;
|
||||||
}, {
|
}, {
|
||||||
deep: true,
|
deep: true,
|
||||||
|
immediate: true,
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue