vue 入门实例

例一
修改opnames的值
: var opnames = new Vue ({ el : '#opname' , data : { opname : opnames , }, methods : { alertPop : function ( name ) { this . opname = name ; } } })
opnames.alertPop("修改opnames的值");
例二: 
var orders = new Vue({
    el: '#orders',
    data: {
        items: [],
    },
    methods: {alertPop: function (arr) {this.items = this.items.concat(arr);}},});
success: function (p) {
    orders.$set(orders.$data, "items", p);//重新渲染
orders.$nextTick(function () {//渲染完毕后运行的函数
})


猜你喜欢

转载自blog.csdn.net/angularwq/article/details/79248288