• VUE2.0实现购物车和地址选配功能学习第六节


    第六节 地址列表过滤和展开所有的地址

    html:
    <li v-for="(item,index) in filterAddress">
    js:
    new Vue({
        el:'.container',
        data:{
            limitNum:3,
            addressList:[],
        },
        mounted:function () {
          this.$nextTick(function () {
              this.getAddressList();
          });
        },
        computed:{
          filterAddress:function () {
              return this.addressList.slice(0,this.limitNum);
              /*return this.addressList.slice(0,3);*/
          }
        },
        methods:{
            getAddressList:function () {
                var _this=this;
                this.$http.get("data/address.json").then(function (response) {
                    var res=response.data;
                    if(res.status=="1"){
                        _this.addressList=res.result;
                    }
                });
            },
            loadMore:function () {
                this.limitNum=this.addressList.length;
            },
    
        }
        });
    效果:

    这章主要是用computed的slice方法,之后会深入研究。



  • 相关阅读:
    做问答系统是对题目修改的bug
    控件treetable使用
    百度地图API --地理位置定位
    按每十分钟查询数据
    《deetom》项目开发历程<六> 免登陆
    poj 3348
    poj 1556
    poj 1269
    poj 3304
    R 540
  • 原文地址:https://www.cnblogs.com/zhus/p/6444851.html
Copyright © 2020-2023  润新知