mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-12 00:20:15 +00:00
## Summary Updates for the linter/formatter deps, turning on some more rules. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7309-WIP-Linter-updates-2c56d73d36508101b3ece6bcaf7e5212) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com> Co-authored-by: Christian Byrne <cbyrne@comfy.org>
29 lines
825 B
Vue
29 lines
825 B
Vue
<script setup lang="ts">
|
|
import { onMounted, ref } from 'vue'
|
|
|
|
import { useCanvasStore } from '@/renderer/core/canvas/canvasStore'
|
|
import { isDOMWidget } from '@/scripts/domWidget'
|
|
import type { SimplifiedWidget } from '@/types/simplifiedWidget'
|
|
|
|
// Button widgets don't have a v-model value, they trigger actions
|
|
const props = defineProps<{
|
|
widget: SimplifiedWidget<void>
|
|
nodeId: string
|
|
}>()
|
|
|
|
const domEl = ref<HTMLElement>()
|
|
|
|
const { canvas } = useCanvasStore()
|
|
onMounted(() => {
|
|
if (!domEl.value) return
|
|
const node = canvas?.graph?.getNodeById(props.nodeId) ?? undefined
|
|
if (!node) return
|
|
const widget = node.widgets?.find((w) => w.name === props.widget.name)
|
|
if (!widget || !isDOMWidget(widget)) return
|
|
domEl.value.replaceChildren(widget.element)
|
|
})
|
|
</script>
|
|
<template>
|
|
<div ref="domEl" />
|
|
</template>
|