Fix ComponentDescription.vue

Make the description change in real time based on incoming prop
This commit is contained in:
timongh 2023-03-11 04:16:43 +08:00
parent 079dc155fd
commit 8faf1ce9f5

View File

@ -6,7 +6,6 @@
import { defineComponent } from 'vue' import { defineComponent } from 'vue'
import type { PropType } from 'vue' import type { PropType } from 'vue'
import type { ComponentMetadata } from '@/components/types' import type { ComponentMetadata } from '@/components/types'
import { getComponentSettings } from '@/core/settings'
import { getDescriptionHTML } from '../description' import { getDescriptionHTML } from '../description'
@ -19,13 +18,17 @@ export default defineComponent({
}, },
data() { data() {
return { return {
settings: getComponentSettings(this.componentData),
html: '', html: '',
} }
}, },
async created() { watch: {
'componentData.description': {
async handler() {
this.html = await getDescriptionHTML(this.componentData) this.html = await getDescriptionHTML(this.componentData)
}, },
immediate: true,
},
},
}) })
</script> </script>