vue2项目转变vue3的方法

我只写vue3的改动

import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
console.log(router);
const app = createApp(App)
app.use(router)
app.mount('#app')

 

import { createStore } from 'vuex'
const store = createStore({
    state,
    getters,
    mutations
})
export default store

 

 
import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
    {
        path: "/",
        name: "index",
        component: index,
        beforeEnter: (to, from, next) => {
      
         



        }
    }
]

export default createRouter({
    history: createWebHashHistory(),
    routes: routes
})
import { createApp } from 'vue'
const appv = createApp({})

appv.directive("tap", {
    bind: function (el, binding) {
        new vueTouch(el, binding, "tap");
    }
});

 

 
import {
  defineConfig
} from 'vite'
import path from "path";
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  resolve: {
    extensions: ['.js','.vue','.json'],
    alias: {
      "@": path.resolve(__dirname, "src")
    },
  },
  plugins: [vue()],
});

主要就上面这些了 反正改动挺大的 

 

posted @ 2022-03-29 17:38  newmiracle宇宙  阅读(1537)  评论(0编辑  收藏  举报