zoukankan      html  css  js  c++  java
  • Vue使用axios无法读取data的解决办法

    今天发现Vue中使用了axios后,then方法中无法读取到data中的数据了,总是提示 Cannot set property 'xxx' of undefined

    上网找了一圈后发现了一下解决方法。

    解决办法1:

    methods:{
        tap:function(){
            var self=this;
            axios.get('xxxxxx')
            .then(function(result){
                self.message='嘿嘿'
            })
        }
    }

    解决办法2:

    axios.get('xxxxxxxxxxx')
    .then((result)=>{
        this.message='嘿嘿'
    })
  • 相关阅读:
    asp.net读取/导入project(mpp)文件
    hdu2103
    hdu2100(大数加)
    hdu1406
    hdu1249
    hdu1038
    hdu2565
    hdu1203
    zoj3501
    hdu2102
  • 原文地址:https://www.cnblogs.com/dengxiaobo/p/7808728.html
Copyright © 2011-2022 走看看