vue

vue element-ui 隐藏上传按钮

1、template:<div>  <el-upload      :class="{hide:hideUpload}"      action=''      list-type="picture-card"      :auto-upload="false"      :show-file-lis...

vue 滑块验证

1、在登录页同级目录下,新建滑块验证页面 JcRange.vue:   2、JcRange.vue:<template><divref="dragVerify"class="drag_verify":@mousemove="dragMoving"@mouseup...
代码星球·2021-02-20

vue 路由守卫,未登录强制跳转到登录页

main.js中,//挂载路由导航守卫router.beforeEach((to,from,next)=>{  //获取tokenconsthasToken=getToken();//to将要访问的路径//from代表从哪个路径跳转而来//next是一个函数,表示放行//next()放行next('/login'...

vue 路由跳转未匹配相应路由后,出现空白页面,指向404页面

1、比如我是写在根目录的:   2、点击跳转到没权限的路由(因为没权限,该路由找不到,显示空白页):3、路由守卫如下:router.beforeEach((to,from,next)=>{consthasToken=getToken();//console.log(hasToken)...

vue 禁止遮罩层下的页面滑动

在遮罩层中,设置:<viewclass="tuikuan-showModal"@touchmove.stop.prevent="moveHandle"></view>//遮罩层 在methods中,设置://遮罩层穿透,阻止底部滑动moveHandle(){return;},  ...

vue 中使用 webSocket 收发数据, 增加 " 心跳机制 " 保持连接.

 1、页面加载时候,开启长连接:created(){this.adminIds=getadminId();this.tokens=getToken();this.merIds=getmerId();//页面刚进入时,判断有无token,有则开启长连接if(this.tokens){this.initWebSo...

vue-element-admin 打包测试环境报错

例如下图的报错方式: 需要删除项目中的dist文件,即可打包成功 ...

vue 分页跳转页面详情,返回记住当前点击第几页

列表页:mounted调用: mounted(){this.getSchoolWebModuleMessageListFunc();}, methods中,定义:getSchoolWebModuleMessageListFunc(){    //当从详情页返回的时候,先获取详情页中存下来的detal...

vue等,利用 .concat() 追加合并数组,并去重

1、比如有这么两个数组(newarr和res.data):   2、数组合并:newarr=newarr.concat(res.data);之后:   3、我们需要的是上面画框的数据,而不是第一条数据(注:newarr和res.data可以切换 )4...

VUE elememt-ui定时器不生效原因

vue中,setTimeout()函数中的this指向的并非vue对象,所以,定义一个_this 暂存this,执行setTimeout函数时,setTimeout函数内的_this就会访问到这个变量,就会得到当前对象。例如:let_this=this;//定义预存变量setTimeout(function(...

vue跨页面传参

例:登录页和首页登录页点击登录跳转到首页的时候,添加该参数:this.$router.replace({path:'/Testing',query:{id:'1',name:this.ruleForm2.account}});   然后在首页获取参数:exportdefault{creat...
代码星球·2021-02-20

vue 使用 proxyTable 解决跨域问题

1、在main.js中,在引入axios:importaxiosfrom'axios'Vue.config.productionTip=falseVue.prototype.$axios=axios//将axios挂载在Vue实例原型上//设置axios请求的tokenaxios.defaults.headers.co...

vue-cli 动态绑定图片失败

1、template中引用图片,第一个为固定路径,第二个为动态绑定路径eg:  <imgsrc="XXXXXX.png">  <img:src="url">当前路径显示为:  第一个图片正常显示,第二个图片无法显示, 解决办法:2、在return的url下,添加require(...

vue-cli 使用 font-awesome 字体插件

在cmd中,运行:cnpminstallfont-awesome在 main.js 里添加import"font-awesome/css/font-awesome.css"...

vue 打包后,后缀名为.woff等字体问题不能用解决办法

1、打开build/ webpack.prod.conf.js,找到module:{  rules:utils.styleLoaders({    sourceMap:config.build.productionSourceMap,    extract:true,    usePostCSS:true  ...