forked from FoundKeyGang/FoundKey
refactor: page.textarea.vue to use composition api
This commit is contained in:
parent
2f432dce65
commit
cff82ea52e
1 changed files with 14 additions and 30 deletions
|
@ -2,38 +2,22 @@
|
||||||
<MkTextarea :model-value="text" readonly></MkTextarea>
|
<MkTextarea :model-value="text" readonly></MkTextarea>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
|
import { watch } from 'vue';
|
||||||
|
import MkTextarea from '../form/textarea.vue';
|
||||||
import { TextBlock } from '@/scripts/hpml/block';
|
import { TextBlock } from '@/scripts/hpml/block';
|
||||||
import { Hpml } from '@/scripts/hpml/evaluator';
|
import { Hpml } from '@/scripts/hpml/evaluator';
|
||||||
import { defineComponent, PropType } from 'vue';
|
|
||||||
import MkTextarea from '../form/textarea.vue';
|
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
block: TextBlock;
|
||||||
MkTextarea
|
hpml: Hpml;
|
||||||
},
|
}>();
|
||||||
props: {
|
|
||||||
block: {
|
let text = $ref(props.hpml.interpolate(props.block.text));
|
||||||
type: Object as PropType<TextBlock>,
|
|
||||||
required: true
|
watch(props.hpml.vars, () => {
|
||||||
},
|
text = props.hpml.interpolate(props.block.text);
|
||||||
hpml: {
|
}, {
|
||||||
type: Object as PropType<Hpml>,
|
deep: true,
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
text: this.hpml.interpolate(this.block.text),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
'hpml.vars': {
|
|
||||||
handler() {
|
|
||||||
this.text = this.hpml.interpolate(this.block.text);
|
|
||||||
},
|
|
||||||
deep: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue