1. vue2.0 给data对象新增属性,并触发视图更新  $set

this.$set(this.ossData, "signature", 222)  // 正确用法
 // 数据
data() {
return {
ossData: {
signature: ''
}
}
} // 正确用法
this.$set(this.ossData, "signature", 222)  // 错误用法
this.ossData.signature = 24

2. el-dialog 弹出组件的遮罩层在弹出层的上面

:append-to-body="true"

3.父组件值变化子组件值变化

(1)Vue父组件向子组件传递一个动态的值,子组件如何保持实时更新实时更新?

 typeCode(newValue, oldValue) {    //watch
this.$set(this.listQuery, 'typeCode', newValue)
this.getList()
}

4.axios在ie浏览器下提示promise未定义

(1) axios在ie浏览器下提示promise未定义

5.vue引用jquery

1:  npm i jquery

2.  webpack.base.conf.js文件中,加入(这一段: new webpack.ProvidePlugin...)

 resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': resolve('src')
}
},
plugins: [
new VueLoaderPlugin(),
// jquery开始
new webpack.ProvidePlugin({
jQuery: "jquery",
$: "jquery"
})
// jquery结束
],

3: import $ from 'jquery

4: end

6.对话框el-dialog关闭事件(包括右上角的x)

<el-dialog title="标题" :visible.sync="bind" size="small" @close='closeDialog'></el-dialog>

7. props default 数组/对象的默认值应当由一个工厂函数返回

 propE: {
type: Object,
default: function () {
return {}
}
}

8.vue中使用 ztree

参考:   ztree在Vue2.5.2下面的运用实战

9.使用element el-date-picker 插件选取时间不回填 

选取时间不回填是因为你的数据属性没有事先在 data 里声明,参见   https://cn.vuejs.org/v2/guide/reactivity.html

10. v-for 需要加上 :key

11.Vue 2中ref属性的使用方法及注意事项

参考: Vue 2中ref属性的使用方法及注意事项

 // html
<ul>
<li v-for="item in people" ref="refContent">{{item}}</li>
</ul> // js
data: {
people:['三姑','四婶','五叔','六姨','七舅姥爷']
},
created: function() {
this.$nextTick(() => {
  // refContent: 存在n个
console.log(this.$refs.refContent[0])
})
}

12. vue去除前后空格trim

 // 使用 trim 修饰符
<input type="text" v-model.trim="content"> // 使用 filter 属性
<input type="text" v-model="name" />
<p> {{ name | trim }}</p> 

13. 子组件和父组件双向数据绑定

vue 实现父组件和子组件之间的数据双向绑定

 // 父组件
<kind-editor :content.sync="editorText" /> // 子组件
<input v-model="editorText" />
watch: {
content(val) {
this.editorText = val
},
editorText(val) {
this.$emit('update:content',val)
}
}

14.指定文件、指定行、指定代码块不使用 ESLint 语法检查

15.axios发送数据

uploadImg (f) {
this.axios.get('./getToken').then((response) => {//获取token
let param = new FormData(); //创建form对象
param.append('file',f.file);//通过append向form对象添加数据
param.append('token',response.data.token);//通过append向form对象添加数据
param.append('key',response.data.key);//添加form表单中其他数据
let config = {
headers:{'Content-Type':'multipart/form-data'}
}; //添加请求头
this.axios.post(f.action,param,config)//上传图片
.then(response=>{
onSuccess(response.data)
})
.catch(({err}) => {
f.onError()
})
})
.catch(() => {
f.onError()
})
},

16.vue项目的多语言/国际化插件vue-i18n详解

(1)vue项目的多语言/国际化插件vue-i18n详解

(2)api

17.vue 报错 exports is not defined?

 // 修改前
import { interNal } from '@/utils/internalReference'
exports.install = function (Vue, options) {
Vue.prototype.filter_rules = function(item) {
}
} // 修改后
import { interNal } from '@/utils/internalReference'
export default {
install(Vue) {
Vue.prototype.filter_rules = function(item) {
}
}}

18.  vue把localhost改成ip地址无法访问—解决方法

(1)修改 package.json文件 增加 --host ip 重新编译即可

(2)dev后面增加  --host 192.168.8.123

 "scripts": {
"dev": "cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js --host 192.168.8.123",
"build:prod": "cross-env NODE_ENV=production env_config=prod node build/build.js",
"build:sit": "cross-env NODE_ENV=production env_config=sit node build/build.js",
"lint": "eslint --ext .js,.vue src",
"test": "npm run lint",
"precommit": "lint-staged",
"svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml"
},

19.vue中使用 scss

<style scoped lang="scss"></style>

20. vue 关闭 eslint 

Use // eslint-disable-next-line to ignore the next line.

21.  Vue Elementui Form表单验证  filter_rules

22.  Vue调试神器vue-devtools安装

23.  删除node_modules文件夹

 // 由于node.js依赖问题,经常出现node_modules文件夹层次过深,从而导致windows无法直接删除。可以全局安装rimraf来解决:
npm install rimraf -g // 用法
rimraf node_modules

24. 清除穿梭框里的搜索值

 <el-transfer
ref="elTransfer"
:titles="[$t('common.altRobot'), $t('common.selectedRobot')]"
v-model="addEditForm.snBoundList"
:data="updateDialog.sn"
:filter-placeholder="$t('common.inpSNSearch')"
filterable/> this.$nextTick(() => {
this.$refs.elTransfer.clearQuery('left')
this.$refs.elTransfer.clearQuery('right')
})

25.

vue element 常见问题的更多相关文章

  1. Vue+Element的动态表单,动态表格(后端发送配置,前端动态生成)

    Vue+Element的动态表单,动态表格(后端发送配置,前端动态生成) 动态表单生成 ElementUI官网引导 Element表单生成 Element动态增减表单,在线代码 关键配置 templa ...

  2. 自搭的一个系统框架,使用Spring boot+Vue+Element

    基于:jdk1.8.spring boot2.1.3.vue-cli3.4.1 特性:    ~ 数据库访问使用spring data jpa+alibaba druid    ~ 前后端数据交互使用 ...

  3. 分享一个自搭的框架,使用Spring boot+Vue+Element UI

    废弃,新的:https://www.cnblogs.com/hackyo/p/10453243.html 特点:前后端分离,可遵循restful 框架:后端使用Spring boot,整合了aop.a ...

  4. 转:vue+element实现树形组件

    项目中需要用到树形组件,在网上发现一个用vue+element实现的树形组件,现在记录下: demo地址:https://github.com/wilsonIs/vue-treeSelect

  5. 前端小菜鸡使用Vue+Element笔记(一)

    关于使用Vue+Element的项目简介~ 最近因为项目组缺前端人员,所以自己现学现做页面,先把前后台功能调通 觉得前端可真的是不容易呀哎呀~ 首先记录一下相关的Vue入门的教程: vue环境搭建示例 ...

  6. Vue + Element UI 实现权限管理系统

    Vue + Element UI 实现权限管理系统 前端篇(一):搭建开发环境 https://www.cnblogs.com/xifengxiaoma/p/9533018.html

  7. vue + element ui 实现实现动态渲染表格

    前言:之前需要做一个页面,能够通过表名动态渲染出不同的表格,这里记录一下.转载请注明出处:https://www.cnblogs.com/yuxiaole/p/9786326.html 网站地址:我的 ...

  8. vue + element ui 表格自定义表头,提供线上demo

    前言:工作中用到 vue+element ui 的前端框架,需要使用自定义表头,需要使用 re.转载请注明出处:https://www.cnblogs.com/yuxiaole/p/9710826.h ...

  9. vue+element ui 的上传文件使用组件

    前言:工作中用到 vue+element ui 的前端框架,使用到上传文件,则想着封装为组件,达到复用,可扩展.转载请注明出处:https://www.cnblogs.com/yuxiaole/p/9 ...

随机推荐

  1. HDU 4126 Genghis Khan the Conqueror (树形DP+MST)

    题意:给一图,n个点,m条边,每条边有个花费,给出q条可疑的边,每条边有新的花费,每条可疑的边出现的概率相同,求不能经过原来可疑边 (可以经过可疑边新的花费构建的边),注意每次只出现一条可疑的边,n个 ...

  2. 在win10 + ie11上使用控件

    1.1. 在Win10+IE11上提示创建文件错误的问题 解决方法: 1.打开Internet选项   2.取消勾选启用保护模式   选择"不再显示此消息"

  3. SVN错误:Attempted to lock an already-locked dir及不能提交.so文件

    当使用svn提交代码时,如果中断提交,就会进入工作拷贝的锁定状态. 这是需要用svn cleanup上次关闭时的锁定 如果没有Tortises,则直接进入到上面的文件夹下的.svn目录,删除lock文 ...

  4. 如何Android中加入扫描名片功能

    要想实现android手机通过扫描名片,得到名片信息,可以使用脉可寻提供的第三方SDK,即Maketion ScanCard SDK,脉可寻云名片识别服务.他们的官方网站为http://www.mak ...

  5. 企业搜索引擎开发之连接器connector(十六)

    本人有一段时间没有接触企业搜索引擎之连接器的开发了,连接器是涉及企业搜索引擎一个重要的组件,在数据源与企业搜索引擎中间起一个桥梁的作用,类似于数据库之JDBC,通过连接器将不同数据源的数据适配到企业搜 ...

  6. CentOS 7.2安装zabbix 3.0 LTS

    1.zabbix简介 zabbix(音同 zæbix)是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案. zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供 ...

  7. HBase介绍(3)---框架结构及流程

    HBASE依托于Hadoop的HDFS作为存储基础,因此结构也很类似于Hadoop的Master-Slave模式,Hbase Master Server 负责管理所有的HRegion Server,但 ...

  8. 数独高阶技巧入门之七——AIC & Nice Loop

    AIC(交替推理链,Alternate Inference Chain) 在简单异数链一文中我们介绍过XY-Chain技法,AIC可以看作是XY-Chain的扩展.有别于XY-Chain仅局限于双值格 ...

  9. Struts2学习第4天--拦截器

    第1章     Struts2_day04笔记 1.1      上次课内容回顾 l  OGNL表达式 n  OGNL的概述 u  OGNL:对象图导航语言,是一门功能强大的表达式语言. n  OGN ...

  10. VMware桥接模式下实现局域网的互通

    在 VMware worktaion pro 14 版本中,创建了 windows server 2003 和 windows xp 两台虚拟机,现在要让它们组成一个局域网(不连接到外网),以下是具体 ...