vue get attribute value

如下:

attribute为"store-qty",其值为"4523"。

vue语法,event.target.getAttribute('store-qty'),可获取其值。

 

 

 

Vue.config.productionTip = false;
        Vue.config.devtools = false;

        var vue_select = new Vue({
            el: '#test',
            data: {
                welcome: "Hello, Insus.NET."
            },           
            methods: {
                getAttrVal(event) {
                    var attrVal = event.target.getAttribute('store-qty');
                    alert(attrVal);
                }
            }
        })
Javascript Source Code

 

posted @ 2020-08-02 16:51  Insus.NET  阅读(1065)  评论(0编辑  收藏  举报