mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-21 14:59:39 +00:00
[Refactor] Extract 'FormItem' and 'SettingItem' (#1619)
* Extract SettingItem component * Extract GeneralSettingItem * Rename to FormItem * nit * nit
This commit is contained in:
25
src/components/common/CustomFormValue.vue
Normal file
25
src/components/common/CustomFormValue.vue
Normal 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>
|
||||
Reference in New Issue
Block a user