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

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

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

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

jsonSubmit: function (arg) {

            var that = this;
            var realInvoker = that[`${arg}`];
            console.log("获取到字符串对应的属性:"+realInvoker)
        },
原文地址:https://www.cnblogs.com/sxdcgaq8080/p/13093504.html