vue.js的params传数据为什么只能接收到id其他传不过?

查看:290
本文介绍了vue.js的params传数据为什么只能接收到id其他传不过?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

created: function() {

      this.getCustomers();//调用方法;
    },
    watch: {
        '$route': 'getCustomers'
    },
    methods: {
        getCustomers: function(){
            /*this.$http.get(this.apiUrl)
                .then((response) =>{
                    this.$set('tasks',response.body.data)
                })
                .catch(function(response){
                    //console.log(response)
                })*/
            var that = this;
            that.$http.get('/static/api/detail.json', {
                 params:{
                     this.title:'10',
                 }
            }).then(function(response){
                this.tasks = response.data.shop;
            },function(response){
                //error
            })
        }
    }

解决方案

 params:{
     this.title:'10', // 這樣不對吧...
     title: '10', // 這樣才正確
 }

这篇关于vue.js的params传数据为什么只能接收到id其他传不过?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆