天下无坑

天下无坑


全局配置vue.config.js

<h4>全局插件</h4> <pre><code class="language-javascript">// vue.config.js const path = require('path'); const webpack = require('webpack'); const globalVars = require('./src/css/var.js'); module.exports = { pages: { index: { entry: 'src/app.js', template: 'index.html', filename: 'index.html', chunks: ['chunk-vendors', 'chunk-common', 'index'] } }, css: { loaderOptions: { less: { globalVars //less全局变量 } } }, configureWebpack: { resolve: { alias: { //路径别名 model: path.resolve(__dirname, 'src/js/model/'), js: path.resolve(__dirname, 'src/js/'), components: path.resolve(__dirname, 'src/components/') } }, plugins: [ new webpack.ProvidePlugin({ Utils: [path.resolve(__dirname, 'src/js/common/utils'), 'default'], Manba: 'manba', //时间格式化组件 HeyUI: 'heyui', //HeyUI Model: 'js-model', //js模型 G: 'hey-global', //全局变量存取 log: 'hey-log', //console.log简写 log() R: [path.resolve(__dirname, 'src/js/common/request'), 'default'] //ajax请求接口 }) ] }, devServer: { proxy: { // 此处应该配置为开发服务器的后台地址 // 配置文档: https://cli.vuejs.org/zh/config/#devserver-proxy '/api': { target: `http://localhost:80/zhongxin/api/public/admin.php`, changeOrigin: true, pathRewrite: { '^/api': '' } }, }, historyApiFallback: true } }; </code></pre>

页面列表

ITEM_HTML