zoukankan      html  css  js  c++  java
  • vue 异步改同步 获取结果 动态函数

    获取异步函数的结果

    //根据路径去读取文件
            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)            }        },

  • 相关阅读:
    NOI2015刷题记录
    [WC2013][UOJ58]糖果公园 莫队算法
    啦啦啦~
    完全平方数
    构建之法
    测试更新
    程序的测试
    程序的封装
    构建之法5.5-6-7章观后感
    给徐侃童鞋的一个汉堡
  • 原文地址:https://www.cnblogs.com/pengfei25/p/13072398.html
Copyright © 2011-2022 走看看