From 1a4fb8e6e27669e6d5e373ab1cb83ae9d85493bf Mon Sep 17 00:00:00 2001 From: Kagol Date: Thu, 7 Nov 2024 20:17:15 +0800 Subject: [PATCH] fix(tree-select): fix tree-select can't load data dynamically close #2287 --- packages/renderless/src/tree-select/vue.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/renderless/src/tree-select/vue.ts b/packages/renderless/src/tree-select/vue.ts index 3ed79e1b53..4836dbaab6 100644 --- a/packages/renderless/src/tree-select/vue.ts +++ b/packages/renderless/src/tree-select/vue.ts @@ -2,7 +2,7 @@ import { filter, nodeClick, check } from './index' export const api = ['state', 'filter', 'nodeClick', 'check'] -export const renderless = (props, { reactive, computed }, { vm, emit }) => { +export const renderless = (props, { reactive, computed, watch }, { vm, emit }) => { const api = {} const state = reactive({ @@ -17,5 +17,11 @@ export const renderless = (props, { reactive, computed }, { vm, emit }) => { check: check({ props, vm, emit }) }) + watch( + () => props.treeOp.data, + (data) => data && (state.treeData = data), + { immediate: true, deep: true } + ) + return api }