1.首先安装vue脚手架, cnpm install -g @vue/cli;(目前是5.0版本)
vue2部分
2.vue新建项目时,用vue create app(新建APP项目),里面的内容可以用y或n选择是否使用模块;
项目完成后会提示 cd app ; 这个命令是进入当前文件下的下个文件目录;
然后运行 npm run serve命令,这个是运行这个项目。
在package.json中修改serve配置:"serve": "vue-cli-service serve --open",结果跳转到0.0.0.0网页,无法打开.百度了一下,如下操作即可,不过network地址变成了本地的.(没找到其他的方法).
在vue.config.js中新增以下代码(我的自带有这个文件,没有的自己创建):
module.exports = {
devServer: {
host: 'localhost',
port: 8080,
https: false,
hot: false,
proxy: null
},
}
3.报错:TypeScript intellisense is disabled on template. To enable, configure `"jsx": "preserve"` in the `"compilerOptions"` property of tsconfig or jsconfig. To disable this prompt instead, configure `"experimentalDisableTemplateSupport": true` in `"vueCompilerO
在jsconfig.json中添加 "jsx": "preserve",属性即可
4.在HTML页面报错:localhost/:1 Refused to apply style from 'http://localhost:8080/iconfont.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.结果发现是reset.css里面引入了这个css,注释即可.
5.看弹幕说vue-router4版本对vue2不太支持,所以我下载了3的版本,如果你们没问题,可以忽略.
cnpm i --save vue-router