vue项目搭建

94 阅读1分钟

vue项目搭建

选择程序放置的文件夹,在路径栏中输入cmd,再按回车打开命令行窗口

2024-01-27-12-01-20.png 在命令行中输入以下内容

vue create threejs

选择vue3默认

2024-01-27-12-02-23.png 创建完成之后的界面是这样

2024-01-27-12-09-02.png 打开创建好的工程项目,在package.json可查看运行命令和安装的依赖

image.png 运行命令

npm run serve

安装依赖

安装threejs依赖

npm i three@0.156.0

下载好之后json文件中未出现threejs的依赖和版本

2024-01-27-13-58-07.png

安装element-plus组件

npm install element-plus

2024-01-27-14-03-39.png

npm i @element-plus/icons-vue vue-router lodash

image-1.png

npm i less less-loader

配置路由

import { createRouter, createWebHashHistory } from "vue-router";
// 定义路由数据
const routes = [
    {
        path:"/login",
        component:()=>import('../views/login.vue')
    },
    {
        path:"/home",
        component:()=>import('../views/home.vue')
    }
]

// 创建router实例
export default createRouter({
    routes,
    history:createWebHashHistory(),
})