1、创建工程:
npm create vite@latest
cd jie-ui-website
npm install
npm run dev
2、添加依赖:
npm install vue-router@4
npm install sass
3、配置路由,创建router目录下index.ts:
import { createRouter, createWebHashHistory } from "vue-router";
const history = createWebHashHistory();
const router = createRouter({
history,
routes: [
{ path: "/", redirect: "" },
],
});
export default router;
在main.ts中导入,应用到整个项目:
import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
const app=createApp(App);
app.use(router);
app.mount('#app');
todo-----