forked from opentiny/tiny-vue
fix(tree-menu): [tree-menu] Fix the issue of asynchronous loading of tree-menu component (#1362)
This commit is contained in:
parent
7e99bcfdc8
commit
0fe5d9a21f
|
@ -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',
|
||||
|
|
|
@ -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 })
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue