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()], });
主要就上面这些了 反正改动挺大的
如果遇到什么不懂的地方直接关注公众号留言(本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。)
作者:newmiracle
出处:https://www.cnblogs.com/newmiracle/