We're sorry but demo3 doesn't work properly without JavaScript enabled. Please enable it to continue.

I encountered a problem today. The response to the vue request was We're sorry but demo3 doesn't work properly without JavaScript enabled. Please enable it to continue., Saying that I did not start js

Because during testing, vue-router was not used for routing

In the end, I was puzzled. I created multiple projects through vue create project for comparison and testing. Finally, I found the reason because the single-file component was not used on the index.html page, so this problem occurred.

 

The content of main.js file is as follows

import Vue from 'vue'
import App from './App.vue'

Vue.config.productionTip = false


new Vue ({
  // render: h => h (App),
    components: {
      App // on the index.html page Without this component, we will return We're sorry but demo3 doesn't work properly without JavaScript enabled. Please enable it to continue.
     }
}). $ Mount ('# app')

 

 

 

Then if you need to compile and run, turn on this parameter

runtimeCompiler

  • Type: boolean

  • Default: false

    Whether to use the Vue build version that includes the runtime compiler. After setting it  true , you can use the template options in the Vue component  , but this will increase your application by about 10kb.

 

Add to the vue.config.js file or package.json file, use the vue field to configure

vue.config.js

vue.config.js It is an optional configuration file. If package.json this file exists in the root directory of the project (and  at the same level), it will be  @vue/cli-service automatically loaded. You can also use  package.json the  vue fields in, but note that this writing requires you to strictly follow the JSON format to write.

Guess you like

Origin www.cnblogs.com/XingXiaoMeng/p/12723777.html