0
我已經安裝了Vue Devtootls,但是每次出現錯誤時,它都不會在控制檯中顯示,我看到他們喜歡[vue:warn]和錯誤。我把這個代碼,但沒有。如何在vue devtools中顯示錯誤?
catch(function(error){ console.log(error.message); });
}
我已經安裝了Vue Devtootls,但是每次出現錯誤時,它都不會在控制檯中顯示,我看到他們喜歡[vue:warn]和錯誤。我把這個代碼,但沒有。如何在vue devtools中顯示錯誤?
catch(function(error){ console.log(error.message); });
}
我認爲你對vue-devtools有一個誤解,vue-devtools是一個瀏覽器擴展,用作調試工具。您可以通過它檢查組件,事件和更多信息。請查看GitHub上的introduction。
在另一方面,像[vue: warn] ...
消息由Vue公司本身產生的。你沒有得到這些消息的原因僅僅是因爲你使用了vue.min.js
而不是vue.js
,我想。將下面的代碼保存爲html文件,然後用chrome打開它。您應該能夠在Chrome控制檯中看到警告消息。
<!DOCTYPE html>
<html>
<head>
<title>Vue test</title>
</head>
<body>
<script type="text/javascript" src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<div id="app">
<span>{{ message }}</span>
<component1></component1>
</div>
<script>
// Vue.component('component1', {
// template: '<button>{{ message }}</button>',
// data: function() {
// return {
// message: 'I am a test button'
// };
// }
// });
var vm = new Vue({
el: '#app',
data: {
message: 'hello'
},
});
</script>
</body>
</html>
警告只顯示在控制檯中,如果您使用非生產Vue公司的(非精縮)版本。 – Bert
你能舉個例子嗎? –