vue中 方法名:function() {} 和 方法名() {}区别

区别就是前者是ES5写法,后者是ES6写法

methods:{
    //ES5
    getData: function (){

    }
    //ES6
    getData() {
        this.axios({
        method: 'get',
        url: '/data.json'
        }).then(function (repos) {
          console.log(repos);
        }).catch(function (error) {
          console.log(error);
        });
    }
}
全部评论

相关推荐

七牛云头号黑子:人家是过度包装被看出来没过简历,你是包都不包啊兄弟
点赞 评论 收藏
分享
2025-12-26 00:57
门头沟学院 golang
菜菜_带带:作弊的前提是你得有真东西,不然很容易就备看出来了,至于混进去,都是面试造火箭,工作拧螺丝罢了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务