mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-03 20:51:58 +00:00
refactor: use emit events pattern instead of mutating props in widget components (#8549)
This commit is contained in:
committed by
GitHub
parent
f9af2cc4bd
commit
b2c8ea3e50
@@ -41,6 +41,10 @@ const {
|
||||
isShownOnParents?: boolean
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:widgetValue': [value: string | number | boolean | object]
|
||||
}>()
|
||||
|
||||
const { t } = useI18n()
|
||||
const canvasStore = useCanvasStore()
|
||||
const favoritedWidgetsStore = useFavoritedWidgetsStore()
|
||||
@@ -83,10 +87,7 @@ const widgetValue = computed({
|
||||
return widget.value
|
||||
},
|
||||
set: (newValue: string | number | boolean | object) => {
|
||||
// eslint-disable-next-line vue/no-mutating-props
|
||||
widget.value = newValue
|
||||
widget.callback?.(newValue)
|
||||
canvasStore.canvas?.setDirty(true, true)
|
||||
emit('update:widgetValue', newValue)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user