DevTools in vue.js

人走茶凉 提交于 2019-12-11 17:17:38

问题


I am using vue.js inside Laravel 5.5.33 (not SPA). I am getting below error.

How can I enable DevTools?


回答1:


Be sure you have this setting in your app.js file

Vue.config.devtools = true

If you are using mix, check the dist of vue in webpack.mix, be sure you don't use min version

mix.js('resources/js/app.js', 'public/js')
    .sass('resources/sass/app.scss', 'public/css')
    .webpackConfig({
        resolve: {
            alias: {
                'vue$': 'vue/dist/vue.js'
            }
        }
    });

Run your npm in dev

npm run watch

WARNING If you refresh your page in your browser, the cache is not refreshed. Clean the cache to reload the app.js




回答2:


This is an old issue when production grade build is used.

You are probably using Vue from CDN, and probably using a production build (dist/vue.min.js). Either replace it with a dev build (dist/vue.js) or add Vue.config.devtools = true to the main js file.

Check out the github link.




回答3:


But, for me, the problem with DevTools was solved just when I put the line that is provided in the answer below after creating your Vue application.

Your code should look like this

new Vue({
 el: '#app',
 data () {
   text: 'testData'
 }
})

Vue.config.devtools = true


来源:https://stackoverflow.com/questions/48617250/devtools-in-vue-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!