加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

关于vue的常识问题及解决方法

发布时间:2020-12-16 23:13:12 所属栏目:百科 来源:网络整理
导读:1. ESLint插件,高亮提示; //首页 import index from '@/components/pages/My/index' ...... routes: [ { path:'/index', name:'index', component:index } ] module.exports = { dev: { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', pr

1.

ESLint插件,高亮提示;

//首页
import index from '@/components/pages/My/index'
......
routes: [
{
path:'/index',
name:'index',
component:index
}
]

module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
proxyTable: {
'/api': {
target:'http://192.168.1.240:18080',
changeOrigin: true,
? ? ?}
}
},
......
?
?
?
?
//main.js
import global from './components/global/global';
Vue.prototype.GLOBAL = global;
?
//global.vue
?
//页面引用接口写法
method:'post',
url:this.GLOBAL.proxy+'/app/course/study.do?courseId='+this.courseId+'&userId='+this.GLOBAL.userId,
?
?
?

:基于 Promise,用于浏览器和 nodejs 的与服务器端通信库。

:npm install axios --save;

六.vuex的安装使用

'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname,'..',dir)
}
//vux的相关配置
const vuxLoader = require('vux-loader')
?
let webpackConfig = {
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js','.vue','.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
},
{
test: /.js$/,
loader: 'babel-loader',
include: [resolve('src'),resolve('test'),resolve('node_modules/webpack-dev-server/client')]
},
{
test: /.(png|jpe?g|gif|svg)(?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /.(mp4|webm|ogg|mp3|wav|flac|aac)(?.*)?$/,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /.(woff2?|eot|ttf|otf)(?.*)?$/,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}
//这个必须放在下面
module.exports = vuxLoader.merge(webpackConfig,{
plugins: ['vux-ui','progress-bar','duplicate-style']
})
?
?
?
?
七.公用顶部导航栏组件
?
?
?
?
?
?
?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读