[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
项目介绍:此项目是基于vue2的前台电商项目和后台管理系统
1:vue-cli脚手架初始化项目生成文件的介绍
1.node_modules文件夹:项目依赖文件夹
2.public文件夹:一般放置一些静态资源(如网页图标),在webpack打包时,会原封不动的打包到dist文件夹。
3.src文件夹:
3.1 assets文件夹:
一般放置多个组件共用的静态资源,在webpack打包时,会把此静态资源当作一个模块,打包到JS文件中。
3.2 components文件夹:一般放置非路由组件。
3.3 app.vue文件:唯一的根组件。
3.4 main.js文件:程序的入口文件,也是整个程序最先执行的文件。
4.babel.config.js文件:babel配置文件。
5.package.json文件:相当于项目的“身份证”,记录了项目的相关信息(如名字、依赖、运行方式等等)。
6.package-lock.json文件:跟踪被安装的每个软件包的确切版本,以便产品可以以相同的方式被 100%
复制(即使软件包的维护者更新了软件包)。
7.README.md文件:项目的说明性文件
2:项目的其他配置
2.1 项目运行时,让浏览器自动打开
在package.json中更改script项,改为如下代码
"scripts": { //在后面添加 --open "serve": "vue-cli-service serve --open", "build":
"vue-cli-service build", "lint": "vue-cli-service lint" }
2.2 关闭eslint的校验功能
在根目录中新建vue.config,js文件,文件中配置如下代码
module.exports = { // 关闭eslint语法校验 lintOnSave:false }
2.3 给src配置别名,方便引入资源
在根目录中新建jsconfig.json文件,写入如下代码
{ // 配置:用 @ 代替src文件夹 "compilerOptions": { "baseUrl": "./", "paths": { "@/*":
["src/*"] } }, "exclude": ["node_modules","dist"] }
配置完成之后可能会报错,原因是vscode会自动进行JavaScript的语法检查,自定义的jsconfig.json文件无法覆盖vscode自带的配置。
解决方法:
第一步:
第二步:
第三步: