一、創建vue單頁面項目
我這裏創建vue項目使用的是Vue-CLI腳手架,Vue CLI 是一個基於 Vue.js 進行快速開發的完整系統。
1. 安裝Vue-CLI
npm install -g @vue/cli
# OR
yarn global add @vue/cli
安裝之後,你就可以在命令行中訪問 vue
命令。你可以通過簡單運行 vue
,看看是否展示出了一份所有可用命令的幫助信息,來驗證它是否安裝成功。
你還可以用這個命令來檢查其版本是否正確:
vue --version
2. 創建項目
vue create front-end
3.安裝依賴
接下來安裝項目所需依賴,我這裏需要安裝的依賴有:axios、babel-polyfill、element-ui、js-md5、moment和vue-quill-editor。
4. 安裝完成後package.json裏的內容
{
"name": "front-end",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.4",
"vue": "^2.6.11",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.3.0",
"@vue/cli-plugin-eslint": "^4.3.0",
"@vue/cli-service": "^4.3.0",
"@vue/eslint-config-standard": "^5.1.2",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"lint-staged": "^9.5.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"@vue/standard"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
],
"gitHooks": {
"pre-commit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,vue}": [
"vue-cli-service lint",
"git add"
]
}
}
二、接下來我們按功能分目錄將文件都創建好
至此我們前端創建項目就已經完成了。
三、項目體驗鏈接
週報管理系統體驗鏈接: https://www.17sucai.com/pins/35488.html
本人前端程序員,長期混跡於各種前端開發中,現在專門爲前端熱愛者建了個微信羣,和大家一起分享自己在工作、學習中遇到的技術知識或問題,還有各種資料和課程,各位感興趣的可以加入哦~