![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
vue
qq_36587340
这个作者很懒,什么都没留下…
展开
-
vue中路由在新的标签页打开
let routeData = this.$router.resolve({ name: 'commercialPreview', query: {cylType: this.$route.query.cylType}, params: { id: this.id } }) window.open(routeData.href, '_blank')原创 2020-03-23 18:09:05 · 957 阅读 · 0 评论 -
vau-cli 拦截器
设置拦截器,统一加载请求头token,可以写一个api统一请求 import axios from 'axios' import store from '../store' import router from '../router' //设置全局axios默认值 axios.defaults.timeout = 5000; //5000的超时验证 axios.defaults.header...原创 2018-08-25 17:21:14 · 157 阅读 · 0 评论 -
父组件向子组件传值
父组件向子组件传值 1、父组件传 父组件: <template> <div> <input type="text" v-model="name"> <br> <br> <!-- 子组件 --> <child :inputName=&quo原创 2018-08-29 10:37:51 · 87 阅读 · 0 评论 -
子组件传值给父组件
子组件传值给父组件 1、 子组件 <template> <div> 子组件: <span>{{childValue}}</span> <!-- 定义一个子组件传值的方法 --> <input type="button" value="点击触发" @click="ch原创 2018-08-29 10:41:49 · 239 阅读 · 0 评论 -
非父子组件传值(同级组件传值)
1、公共bus.js import Vue from 'vue'; // 使用 Event Bus const bus = new Vue(); export default bus; 2、组件1 <template> <div> A组件: <span>{{elementValue}}</span> <...原创 2018-08-29 10:49:50 · 350 阅读 · 0 评论 -
vue-cli打包后在IE中显示不出问题
解决办法: 安装: 步骤一:npm install babel-polyfill --save-dev 步骤二:在mmain.js中引入 import "babel-polyfill";(如果有用vuex在store中的index.js中也最好引入一下) 步骤三:在build文件中的 webpack.base.conf.js 中的 entry对象中也添加一下 entry: { ...原创 2018-09-01 11:09:38 · 2082 阅读 · 0 评论 -
vue 自定义指令
1、input中的v-focus自定义指令主要作用进入页面中获取input焦点; 2、div中v-demo为自定义指定,cur主要是看指令更新的,为动态更新时的值; 3、button中add事件为检测cur中的值变化,从而触发v-demo指令中的update方法中的变化; 4、button中unbind解除指令绑定,点击后绑定自定义指令的div中值不在有关联,在点击add页面中cur的值不...原创 2019-07-02 10:08:40 · 135 阅读 · 0 评论