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