Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

vue created中发送请求并将请求到的数据渲染到dom

### 问题描述

### 问题出现的环境背景及自己尝试过哪些方法

### 相关代码
粘贴代码文本(请勿用截图)
<template>
<span>{{ tableDataDep }}</span>
</template>

export default {
data() {

return {
tableDataDep:null
}

},
created() {

this.getTreeData();

},
methods(){
getTreeData() {

  getDepartTree()
    .then((res) => {
      if (res.error_code == 0) {
        let reee = [];
        reee.push(res.data);
        this.dataTree = reee;
        this.tableDataDep = res.data.text;
      } else {
        this.$message.error("请求失败");
      }
    })
    .finally(() => {
      this.treeLoading = false;
    });
},

}
}
### 你期待的结果是什么?实际看到的错误信息又是什么?
tableDataDep并没有渲染到dom


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

哪里来的
getDepartTree 方法???


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...