安装好的项目目录
1).browserslistrc
浏览器的兼容性
原先
补充
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8",
"not ie <= 11",
"Android >= 4.0",
"iOS >= 8"
]
2)vue.config.js
配置代理
module.exports = {
devServer: {
open: true, // 配置自动启动浏览器
// 设置代理 devServer.proxy 可以是一个指向开发环境 API 服务器的字符串
proxy: {
'/api': {
// target: 'http://118.178.84.155:8080/wifi-cms/api', // 域名 这会告诉开发服务器将任何未知请求 (没有匹配到静态文件的请求) 代理到http://
target: 'http://118.178.84.155:5050/api',
// target: 'http://10.191.1.1:80/api',
changOrigin: true, // 开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求的数据,这样服务端和服务端进行数据的交互就不会有跨域问题
ws: true,
pathRewrite: {
'^/api': '' // 替换target中的请求地址,也就是说,在请求的时候,url用'/proxy'代替'http://ip.taobao.com'
}
}
}
}
}
3).eslintrc.js 规范代码
vscode自动保存eslint | vue配置eslint规则
4).postcssrc.js postcss.config.js 适配手机
Vue3.0开发中的移动端适配(px转换成vw)不用修改原来的代码,特别爽
// 新建.postcssrc.js
module.exports = {
'plugins': {
'postcss-import': {
},
'postcss-url': {
},
'postcss-aspect-ratio-mini': {
},
'postcss-write-svg': {
utf8: false
},
'postcss-cssnext': {
},
'postcss-px-to-viewport': {
viewportWidth: 340, // 视窗的宽度,对应的是我们设计稿的宽度,一般是750
viewportHeight: 1334, // 视窗的高度,根据750设备的宽度来指定,一般指定1334,也可以不配置
unitPrecision: 3, // 指定`px`转换为视窗单位值的小数位数
viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw
selectorBlackList: ['.ignore', '.hairlines'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false, // 允许在媒体查询中转换`px`
exclude: /(\/|\\)(node_modules)(\/|\\)/
},
'postcss-viewport-units': {
filterRule: rule => rule.selector.includes('::after') && rule.selector.includes('::before') && rule.selector.includes(':after') && rule.selector.includes(':before')
},
'cssnano': {
preset: 'advanced',
autoprefixer: false,
'postcss-zindex': false
},
}
}
// postcss.config.js
module.exports = {
plugins: {
autoprefixer: {
}
}
}
"postcss-aspect-ratio-mini": "^1.0.1",
"postcss-cssnext": "^3.1.0",
"postcss-import": "^12.0.1",
"postcss-px-to-viewport": "^1.1.1",
"postcss-url": "^8.0.0",
"postcss-viewport-units": "^0.1.6",
"postcss-write-svg": "^3.0.1",
"cssnano": "^4.1.10",
"cssnano-preset-advanced": "^4.0.7",
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install cssnano --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ cssnano@4.1.10
updated 1 package in 31.472s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install cssnano-preset-advanced --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ cssnano-preset-advanced@4.0.7
added 8 packages from 3 contributors in 25.685s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-aspect-ratio-mini --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-aspect-ratio-mini@1.0.1
added 1 package from 1 contributor in 31.529s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-cssnext --save
npm WARN deprecated postcss-cssnext@3.1.0: 'postcss-cssnext' has been deprecated in favor of 'postcss-preset-env'. Read more at https://moox.io/blog/deprecating-cssnext/
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-cssnext@3.1.0
added 126 packages from 211 contributors in 52.204s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-import --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-import@12.0.1
added 4 packages from 3 contributors in 27.762s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-px-to-viewport --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-px-to-viewport@1.1.1
added 1 package from 1 contributor in 26.114s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-url --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-url@8.0.0
added 3 packages from 2 contributors in 32.291s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-viewport-units --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-viewport-units@0.1.6
added 10 packages from 4 contributors in 42.683s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install postcss-write-svg --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ postcss-write-svg@3.0.1
added 10 packages from 4 contributors in 32.066s
43 packages are looking for funding
run `npm fund` for details
5)router vuex axios mockjs
npm install vue-router --save
npm install vuex --save
npm install axios --save
npm install mockjs --save
$ npm install vue-router --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ vue-router@3.1.6
added 1 package from 1 contributor in 26.619s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install vuex --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ vuex@3.1.3
added 1 package from 1 contributor in 27.327s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install axios --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ axios@0.19.2
added 4 packages from 7 contributors in 32.412s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install mockjs --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ mockjs@1.1.0
added 1 package from 1 contributor in 26.427s
43 packages are looking for funding
run `npm fund` for details
6)cube-ui 学习慕课网的cube-ui安装
vue add cube-ui
7)core-js是什么
它是JavaScript标准库的polyfill
它尽可能的进行模块化,让你能选择你需要的功能
它可以不污染全局空间
它和babel高度集成,可以对core-js的引入进行最大程度的优化
"better-scroll": "^1.15.2",
"caniuse-lite": "^1.0.30001015",
"file-loader": "^3.0.1",
"url-loader": "^1.1.2",
"vue-awesome-swiper": "^3.1.3",
"swiper": "^4.4.6",
"lyric-parser": "^1.0.1",
"video.js": "^7.5.4",
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install better-scroll --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ better-scroll@1.15.2
added 1 package from 1 contributor and updated 1 package in 29.639s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install caniuse-lite --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ caniuse-lite@1.0.30001035
updated 1 package in 24.68s
43 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install file-loader --save
npm WARN rollback Rolling back node-pre-gyp@0.14.0 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'D:\0 work\source\new_huaxia\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ file-loader@6.0.0
added 2 packages from 1 contributor and updated 1 package in 25.33s
44 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install url-loader --save
npm WARN rollback Rolling back readable-stream@2.3.7 failed (this is probably harmless): EPERM: operation not permitted, scandir 'D:\0 work\source\new_huaxia\node_modules\fsevents\node_modules'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ url-loader@4.0.0
added 2 packages from 1 contributor and updated 1 package in 22.629s
45 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install vue-awesome-swiper --save
npm WARN rollback Rolling back readable-stream@2.3.7 failed (this is probably harmless): EPERM: operation not permitted, scandir 'D:\0 work\source\new_huaxia\node_modules\fsevents\node_modules'
npm WARN vue-awesome-swiper@4.0.2 requires a peer of swiper@^5.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ vue-awesome-swiper@4.0.2
added 1 package from 1 contributor in 22.092s
45 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install swiper --save
> swiper@5.3.6 postinstall D:\0 work\source\new_huaxia\node_modules\swiper
> echo "Love Swiper? Support Vladimir's work by donating or pledging on patreon:
> https://patreon.com/vladimirkharlampidi
"
"Love Swiper? Support Vladimir's work by donating or pledging on patreon:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ swiper@5.3.6
added 3 packages from 1 contributor in 26.435s
46 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install video.js --save
npm WARN notsup Unsupported engine for pkcs7@1.0.2: wanted: {
"npm":"^1.4.6","node":"^0.10"} (current: {
"node":"12.13.1","npm":"6.13.2"})
npm WARN notsup Not compatible with your version of node/npm: pkcs7@1.0.2
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ video.js@7.6.6
added 21 packages from 20 contributors in 39.494s
46 packages are looking for funding
run `npm fund` for details
Administrator@PC-20190603POBK MINGW64 /d/0 work/source/new_huaxia (master)
$ npm install lyric-parser --save
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {
"os":"darwin","arch":"any"} (current: {
"os":"win32","arch":"x64"})
+ lyric-parser@1.0.1
added 1 package from 1 contributor in 27.147s
46 packages are looking for funding
run `npm fund` for details
最后下载完毕的package.json
"dependencies": {
"axios": "^0.19.2",
"better-scroll": "^1.15.2",
"caniuse-lite": "^1.0.30001035",
"core-js": "^3.6.4",
"cssnano": "^4.1.10",
"cssnano-preset-advanced": "^4.0.7",
"cube-ui": "~1.12.15",
"file-loader": "^6.0.0",
"lyric-parser": "^1.0.1",
"mockjs": "^1.1.0",
"postcss-aspect-ratio-mini": "^1.0.1",
"postcss-cssnext": "^3.1.0",
"postcss-import": "^12.0.1",
"postcss-px-to-viewport": "^1.1.1",
"postcss-url": "^8.0.0",
"postcss-viewport-units": "^0.1.6",
"postcss-write-svg": "^3.0.1",
"swiper": "^5.3.6",
"url-loader": "^4.0.0",
"video.js": "^7.6.6",
"vue": "^2.6.11",
"vue-awesome-swiper": "^4.0.2",
"vue-router": "^3.1.6",
"vuex": "^3.1.3"
},