[Refactor] Extract 'FormItem' and 'SettingItem' (#1619)

* Extract SettingItem component

* Extract GeneralSettingItem

* Rename to FormItem

* nit

* nit
This commit is contained in:
Chenlei Hu
2024-11-20 15:10:17 -05:00
committed by GitHub
parent 4f3693e322
commit f34d50da3d
5 changed files with 152 additions and 102 deletions

View File

@@ -0,0 +1,25 @@
<template>
<div ref="container"></div>
</template>
<script setup lang="ts">
import { ref, onMounted, watch } from 'vue'
const props = defineProps<{
renderFunction: () => HTMLElement
}>()
const container = ref<HTMLElement | null>(null)
function renderContent() {
if (container.value) {
container.value.innerHTML = ''
const element = props.renderFunction()
container.value.appendChild(element)
}
}
onMounted(renderContent)
watch(() => props.renderFunction, renderContent)
</script>