Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tree-select): [tree-select] fix tree-select can't load data dynamically close #2287 #2500

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/renderless/src/tree-select/vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里对数据进行深度监听,万一用户的数据量很多会不会造成性能问题呢?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段代码是从select组件迁移的,后续如果遇到大数据场景再进行优化处理

)

return api
}
Loading