![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue
-柠檬不要羡慕西瓜的甜i
这个作者很懒,什么都没留下…
展开
-
如何在vue中判断用户是否登录,登录权限
import Vue from 'vue'import Vuex from 'vuex'Vue.use(Vuex)const key = 'user'const stateKey = 'stateKey'const isLogin = 'isLogin'const store = new Vuex.Store({ state () { return { user: null, stateKey: false, isLogin: '0' }原创 2018-07-03 14:52:58 · 21717 阅读 · 3 评论 -
vue动态设置页面title方法
npm install vue-wechat-title --save在main.js中引入://设置titleimport VueWechatTitle from 'vue-wechat-title'Vue.use(VueWechatTitle)或者:Vue.use(require('vue-wechat-title'))然后在router的路由参数中加入meta参...原创 2019-02-12 15:22:34 · 875 阅读 · 0 评论 -
vue2.0项目中使用Ueditor富文本编辑器示例
1、首先需要下载Ueditor富文本编辑器:下载地址如下:https://ueditor.baidu.com/website/download.html该例子使用的是1.4.3.3 PHP UTF-8版本 如图所示: 2、将下载的Ueditor文件放入static中ue文件夹下, 如图所示:修改ueditor.config.js文件,修改代码如下所示: wind...原创 2019-02-17 13:58:12 · 1276 阅读 · 2 评论 -
Vue项目与nginx部署跨域问题
在使用Vue构建的前端工程中,访问本地不同ip与端口,都会存在跨域问题,下面给出一个使用代理解决的办法: 在config目录的index.js文件中,添加: proxyTable: { '/api':{ target:'https://api.douban.com', changeOrigin: true, path...原创 2018-11-06 10:46:08 · 1872 阅读 · 1 评论 -
ElementUI中获取select 的label值
在某些业务场景下,我们需要获取select的lable值和value值获取label值代码如下:<el-form-item label="测试" prop="goodsLocationId" > <el-col :span="15"> <el-select v-model="scope.row.goodsLocationId&q原创 2018-09-20 10:15:21 · 15803 阅读 · 6 评论 -
vue父子组件传递参数
父组件代码展示如下:<template> <div> <h2>parent父组件部分</h2> <child ref="child" :message="parentMsg" v-on:listenToChildEvent="showMsgFromChild"></chi原创 2018-09-06 19:59:14 · 885 阅读 · 0 评论 -
vue中添加favicon图标
1、在项目根目录下放入favicon.icon图标2、index.html中引入<link ref="shortcut icon" href="./favicon.icon" type="image/x-icon">3、在这两个文件夹下编辑代码: 在这两个文件夹添加同样的代码 引入文件图标 清缓存,重启浏览器即可...原创 2018-09-04 20:21:22 · 1426 阅读 · 0 评论 -
vue中使用axios请求接口,请求会发送两次
vue中使用axios请求接口,请求会发送两次的问题浏览器分为简单请求以及非简单请求:解决方案:跨域请求需要先发一次Option预请求,OPTIONS是检验是否允许跨域的,如果不希望OPTIONS请求, 直接让后端遇到option直接返回就可以了,前端可不做处理。...原创 2018-07-23 10:37:50 · 10873 阅读 · 0 评论 -
vue中项目打包好后,elementUI样式优先级高,覆盖本地样式
vue中项目打包好后,elementUI样式优先级高,覆盖本地样式解决方案如下:(1)简单粗暴使用!important加强style优先级(2)将样式impoimport至App的上方(3)增加css选择器 , 增强youj优先级...原创 2018-07-23 10:33:53 · 10918 阅读 · 0 评论 -
使用vuex存储用户信息到localStorage
1、首先需要装vuex npm install vuex -d2、新建store文件夹,新建index.js, 并引入vue、vuex,代码如下:import Vue from 'vue'import Vuex from 'vuex'Vue.use(Vuex)const key = 'user'const store = new Vuex.Store({ state () { ...原创 2018-07-03 15:47:17 · 6880 阅读 · 1 评论 -
VUE通过路由 QUERY传递参数
父组件通过query来传递num参数为1,相当与在 url 地址后面拼接参数<template> <div> <h3>首页</h3> <router-link :to="{ path:'/home/game', query: { id: 1} }"> <but..原创 2018-07-03 15:36:28 · 1082 阅读 · 0 评论 -
vue原生table合并单元格
<template> <div> <div class="el-card box-card table_container"> <div class="el-card__header"> <div class="header clearfix&qu原创 2018-07-03 15:30:36 · 4896 阅读 · 1 评论 -
vue中配置后端接口服务信息
vue中配置后端接口服务信息最重要一点:配置完信息后,重新启动服务 npm run dev需要在config下的index.js中 找到module.exports = { dev: { }}以此接口地址为例:dev: { // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', proxyTab...原创 2018-07-03 15:03:32 · 6285 阅读 · 0 评论 -
vue项目中添加水印效果
基于vue的架构中,在网页中添加水印效果,具体实现 代码如下:新建js文件:例如warterMark.js'use strict' let watermark = {} let setWatermark = (str) => { let id = '1.23452384164.123412415' if (document.getElementById(id) ...原创 2019-02-14 09:59:46 · 15132 阅读 · 10 评论