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

动态加载子节点的格式问题 #47

Closed
H-Sven opened this issue Apr 17, 2019 · 3 comments
Closed

动态加载子节点的格式问题 #47

H-Sven opened this issue Apr 17, 2019 · 3 comments

Comments

@H-Sven
Copy link

H-Sven commented Apr 17, 2019

提示 main.vue?4a51:512 You must return a Promise instance in loadChildrenMethod ! 请问网络请求回来的数据需要满足什么样的格式

getLoadChildrenMethod(value) {
      let test = [
        { label: '微信扫码1', value: '1-1' },
        { label: '微信扫码2', value: '1-2' },
        { label: '微信扫码3', value: '1-3' },
        { label: '微信扫码4', value: '1-4' }
      ]
      return new Promise((resolve, reject) => {
        console.log(test)
        resolve(test)
      })
    }
@H-Sven
Copy link
Author

H-Sven commented Apr 17, 2019

我返回Promise 一样报这个警告

getLoadChildrenMethod(parentItem) {
      return new Promise((resolve, reject) => {
        if (parentItem.lv === 1) {
          this.getOptions2(parentItem.value).then(res => {
            parentItem.children = res
          })
        } else if (parentItem.lv === 2) {
          this.getOptions3(parentItem.value).then(res => {
            parentItem.children = res
          })
        }
        resolve(parentItem.children)
      })
    }

@H-Sven
Copy link
Author

H-Sven commented Apr 17, 2019

@webCoderJ 哈喽,能解答一下这个问题吗? 现在进度卡住了

@webCoderJ
Copy link
Owner

不好意思哈 这两天搬砖有点忙 周五会更新一版 可以关注一下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants