vue.js中定义data中的属性:

【VUE】根据字符串获取对应的属性

 

 

 

vue.html中定义一个按钮,绑定点击事件,入参即字符串:

【VUE】根据字符串获取对应的属性

 

 

 

vue.js的method中定义该点击方法:

【VUE】根据字符串获取对应的属性

 

 

 

jsonSubmit: function (arg) {

            var that = this;
            var realInvoker = that[`${arg}`];
            console.log("获取到字符串对应的属性:"+realInvoker)
        },

 

相关文章: