mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
Make vue inputs reactive
This commit is contained in:
@@ -231,6 +231,15 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager {
|
|||||||
reactiveWidgets.splice(0, reactiveWidgets.length, ...v)
|
reactiveWidgets.splice(0, reactiveWidgets.length, ...v)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
const reactiveInputs = shallowReactive<INodeInputSlot[]>(node.inputs ?? [])
|
||||||
|
Object.defineProperty(node, 'inputs', {
|
||||||
|
get() {
|
||||||
|
return reactiveInputs
|
||||||
|
},
|
||||||
|
set(v) {
|
||||||
|
reactiveInputs.splice(0, reactiveInputs.length, ...v)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const safeWidgets = reactiveComputed<SafeWidgetData[]>(() => {
|
const safeWidgets = reactiveComputed<SafeWidgetData[]>(() => {
|
||||||
node.inputs?.forEach((input, index) => {
|
node.inputs?.forEach((input, index) => {
|
||||||
@@ -265,7 +274,7 @@ export function useGraphNodeManager(graph: LGraph): GraphNodeManager {
|
|||||||
badges,
|
badges,
|
||||||
hasErrors: !!node.has_errors,
|
hasErrors: !!node.has_errors,
|
||||||
widgets: safeWidgets,
|
widgets: safeWidgets,
|
||||||
inputs: node.inputs ? [...node.inputs] : undefined,
|
inputs: reactiveInputs,
|
||||||
outputs: node.outputs ? [...node.outputs] : undefined,
|
outputs: node.outputs ? [...node.outputs] : undefined,
|
||||||
flags: node.flags ? { ...node.flags } : undefined,
|
flags: node.flags ? { ...node.flags } : undefined,
|
||||||
color: node.color || undefined,
|
color: node.color || undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user