mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
Refactor components/page/page.textarea.vue to composition API
https://akkoma.dev/FoundKeyGang/FoundKey/pulls/26
This commit is contained in:
parent
a020534140
commit
8d5ec8662e
@ -2,38 +2,23 @@
|
||||
<MkTextarea :model-value="text" readonly></MkTextarea>
|
||||
</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 { Hpml } from '@/scripts/hpml/evaluator';
|
||||
import { defineComponent, PropType } from 'vue';
|
||||
import MkTextarea from '../form/textarea.vue';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkTextarea
|
||||
},
|
||||
props: {
|
||||
block: {
|
||||
type: Object as PropType<TextBlock>,
|
||||
required: true
|
||||
},
|
||||
hpml: {
|
||||
type: Object as PropType<Hpml>,
|
||||
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
|
||||
}
|
||||
}
|
||||
const props = defineProps<{
|
||||
block: TextBlock;
|
||||
hpml: Hpml;
|
||||
}>();
|
||||
|
||||
let text = $ref('');
|
||||
|
||||
watch(props.hpml.vars, () => {
|
||||
text = props.hpml.interpolate(props.block.text) as string;
|
||||
}, {
|
||||
deep: true,
|
||||
immediate: true,
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user