vue項目建成之后需要修改的地方:
(我的vue用了Element插件,已經(jīng)用npm裝過了npm i element-ui -S)
package.json
在package.json的dependencies內(nèi)加入項目運行需要的依賴
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內(nèi)添加
{
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 ? ?//端口號
……
}
加一點不大相關(guān)的
Tomcat里conf>web.xml(最后的welcome-file-list之前加上)
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>