Uncaught (in promise) 的解决方法

mac2024-02-20  48

<script type="text/javascript"> var vm = new Vue({ el:'#app', data:{ msg:'hello world' }, methods:{ getInfo(){ this.$http.jsonp('http://api.vue-tp5.com/v1/index/index').then(function(result){ console.log(result) }).catch(function(error){ console.log(error); }); } } }); </script>

在then后加上catch即可

最新回复(0)