创建实例

  • 主入口 main.ts 中

Vue3: creatApp()

  1. import App from './App.vue';
  2. import { createApp } from 'vue';
  3. import { router } from './router';
  4. const app = createApp(App);
  5. app.use(router);
  6. app.mount('#app')

Vue2: new Vue()

  1. import App from './App.vue';
  2. import Vue from 'vue';
  3. import router from './router';
  4. Vue.config.productionTip = false;
  5. new Vue({
  6. router,
  7. render: h => h(App)
  8. }).$mount('#app')