fix(tree-menu): [tree-menu] Fix the issue of asynchronous loading of tree-menu component (#1362)

This commit is contained in:
wuyiping0628 2024-02-01 19:01:37 -08:00 committed by GitHub
parent 7e99bcfdc8
commit 0fe5d9a21f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -467,7 +467,7 @@ export default {
'zh-CN': '自定义获取服务端数据源的方法,返回一个 Promise 对象',
'en-US': 'Customize the method for obtaining server-side data sources and return a Promise object'
},
'demoId': 'get-menu-data-sync'
'demoId': 'data-resource'
},
{
'name': 'indent',

View File

@ -12,14 +12,14 @@
export const initData =
({ state, props, service, api }) =>
() => {
async () => {
if (props.data) {
state.data = props.data
return
}
if (typeof service.getMenuDataSync === 'function') {
const menuData = service.getMenuDataSync()
const menuData = await service.getMenuDataSync()
state.data = api.setMenuKey({ newData: [], menuData })
}