获取异步函数的结果
//根据路径去读取文件 async getContentByPath(val){ let address = val.data.contentPath && decodeURI(val.data.contentPath.split("path=")[1]) const res = await this.$ajax.get(this.url.getContentByPath, { path: address }) if (res.code == 200) { return res.data } },
动态函数
//处理增删改 handleNode(obj) { let operType = this.oper[obj.i]["type"] const treeName = obj.treeName const value = Object.assign(obj.d,{operType,treeName}) this.operCurrentNode = value try { eval("this." + operType + "(value)") //this[operType](value) } catch (e) { this.nodeOthers(operType,value) } },
//处理增删改 handleNode(obj) { let operType = this.oper[obj.i]["type"] const treeName = obj.treeName const value = Object.assign(obj.d,{operType,treeName}) this.operCurrentNode = value try { eval("this." + operType + "(value)") //this[operType](value) } catch (e) { this.nodeOthers(operType,value) } },