Global script file main.js (Project entrance)

  • main.js is the entrance to the project file
  • new Vue () is to create a root component reads a file .vue render, $ mount rendering replacement of placeholder index.html
  • Project relies on the environment, such as: vue environment, routing environment, warehouse environments, third-party environment, customized environment is done in main.js in
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app')

 rewrite:

import Vue from 'vue' // load vue environment 
import App from './App.vue' // load the root assembly 
import router from './router' // load routing environment 
import store from './store' // Load data warehouse environment 

Vue.config.productionTip = false; // tip tips 

Import from FirstCP './views/FirstCP' 
new new Vue ({ 
    EL: '#app', 
    Router: Router, 
    Store: Store, 
    the render: function (readVueFn ) { 
        return readVueFn (FirstCP); // read FirstCP.vue replace the placeholder index.html 
    } 
});

 

 

Guess you like

Origin www.cnblogs.com/baohanblog/p/12305064.html