vue项目建成之后需要修改的地方:
(我的vue用了Element插件,已经用npm装过了npm i element-ui -S)
package.json
在package.json的dependencies内加入项目运行需要的依赖
eg:"echarts": "^3.3.2",
"element-ui": "^1.2.8",
"font-awesome": "^4.7.0",
"jquery": "^1.11.1",
"nprogress": "^0.2.0", //进度条
"vue": "^2.2.2",
"vue-router": "^2.3.0",
"vuex": "^2.0.0-rc.6",
"webpack": "^2.4.1"
webpack.base.conf.js
var webpack =require("webpack")
module.exports的最后加入
plugins: [newwebpack.optimize.CommonsChunkPlugin('common.js'),newwebpack.ProvidePlugin({ jQuery:"jquery", $:"jquery"})]
src>main.js
引入文件
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-default/index.css'
import "./assets/css/iconfont.css" //css文件
import $ from 'jquery'//需要的地方引入
Vue.use(ElementUI)
src>router>index.js
import Other from '@/components/other' //新建的文件
并在routes内添加
{
path: '/Other',
name: 'Other',
component: Other,
children:[……
]}
src>app.vue
删掉<img src="./assets/logo.png">
config>index.js
build: {
index: path.resolve(__dirname, '../dist/index.html'), //打包存放路径及文件名
assetsRoot: path.resolve(__dirname, '../dist'),
assetsPublicPath: '/', //打包地址(文件部署地址)
……
},
dev:{
port:80 //端口号
……
}
加一点不大相关的
Tomcat里conf>web.xml(最后的welcome-file-list之前加上)
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
网友评论