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

  1. this.$set(this.ossData, "signature", 222)  // 正确用法
  1. // 数据
  2. data() {
  3. return {
  4. ossData: {
  5. signature: ''
  6. }
  7. }
  8. }
  9.  
  10. // 正确用法
  11. this.$set(this.ossData, "signature", 222) 
  12.  
  13. // 错误用法
  14. this.ossData.signature = 24

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

  1. :append-to-body="true"

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

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

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

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

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

5.vue引用jquery

1:  npm i jquery

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

  1. resolve: {
  2. extensions: ['.js', '.vue', '.json'],
  3. alias: {
  4. '@': resolve('src')
  5. }
  6. },
  7. plugins: [
  8. new VueLoaderPlugin(),
  9. // jquery开始
  10. new webpack.ProvidePlugin({
  11. jQuery: "jquery",
  12. $: "jquery"
  13. })
  14. // jquery结束
  15. ],

3: import $ from 'jquery

4: end

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

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

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

  1. propE: {
  2. type: Object,
  3. default: function () {
  4. return {}
  5. }
  6. }

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属性的使用方法及注意事项

  1. // html
  2. <ul>
  3. <li v-for="item in people" ref="refContent">{{item}}</li>
  4. </ul>
  5.  
  6. // js
  7. data: {
  8. people:['三姑','四婶','五叔','六姨','七舅姥爷']
  9. },
  10. created: function() {
  11. this.$nextTick(() => {
  12.   // refContent: 存在n个
  13. console.log(this.$refs.refContent[0])
  14. })
  15. }

12. vue去除前后空格trim

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

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

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

  1. // 父组件
  2. <kind-editor :content.sync="editorText" />
  3.  
  4. // 子组件
  5. <input v-model="editorText" />
  6. watch: {
  7. content(val) {
  8. this.editorText = val
  9. },
  10. editorText(val) {
  11. this.$emit('update:content',val)
  12. }
  13. }

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

15.axios发送数据

  1. uploadImg (f) {
  2. this.axios.get('./getToken').then((response) => {//获取token
  3. let param = new FormData(); //创建form对象
  4. param.append('file',f.file);//通过append向form对象添加数据
  5. param.append('token',response.data.token);//通过append向form对象添加数据
  6. param.append('key',response.data.key);//添加form表单中其他数据
  7. let config = {
  8. headers:{'Content-Type':'multipart/form-data'}
  9. }; //添加请求头
  10. this.axios.post(f.action,param,config)//上传图片
  11. .then(response=>{
  12. onSuccess(response.data)
  13. })
  14. .catch(({err}) => {
  15. f.onError()
  16. })
  17. })
  18. .catch(() => {
  19. f.onError()
  20. })
  21. },

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

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

(2)api

17.vue 报错 exports is not defined?

  1. // 修改前
  2. import { interNal } from '@/utils/internalReference'
  3. exports.install = function (Vue, options) {
  4. Vue.prototype.filter_rules = function(item) {
  5. }
  6. }
  7.  
  8. // 修改后
  9. import { interNal } from '@/utils/internalReference'
  10. export default {
  11. install(Vue) {
  12. Vue.prototype.filter_rules = function(item) {
  13. }
  14. }}

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

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

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

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

19.vue中使用 scss

  1. <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文件夹

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

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

  1. <el-transfer
  2. ref="elTransfer"
  3. :titles="[$t('common.altRobot'), $t('common.selectedRobot')]"
  4. v-model="addEditForm.snBoundList"
  5. :data="updateDialog.sn"
  6. :filter-placeholder="$t('common.inpSNSearch')"
  7. filterable/>
  8.  
  9. this.$nextTick(() => {
  10. this.$refs.elTransfer.clearQuery('left')
  11. this.$refs.elTransfer.clearQuery('right')
  12. })

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. hadoop理解

    Hadoop的主核心有2部分: 1,HDFS 2, MapReduce 首先: HDFS HDFS(Hadoop Distributed File System,Hadoop分布式文件系统),它是一个 ...

  2. 结构光和ToF

  3. How To Start Building Spatially Aware Apps With Google’s Project Tango

    How To Start Building Spatially Aware Apps With Google’s Project Tango “Tango can enable a whole new ...

  4. top命令查看进程列表

    top命令查看进程列表 top命令是linux下常用的性能分析工具,能实时显示系统中各个进程的资源占用状况.和win的资源管理器类似.top是一个动态显示过程,即可以通过用户按键来不断刷新当前状态,如 ...

  5. ubuntu 编译安装 mod_wsgi

    在编译过程中遇到一些问题,记录下来方便别人使用. step1: 下载.windows下面会有编译好的包,Ubuntu没有需要自己编译. 地址: https://github.com/GrahamDum ...

  6. T-SQL逻辑查询

    理解T-SQL的逻辑查询顺序是学习SQL Server的基础. T-SQL逻辑执行顺序 (8)    SELECT (9) DISTINCT (11) <TOP_specification> ...

  7. [Asp.net Mvc]为js,css静态文件添加版本号

    方式一: 思路 string version = ViewBag.Version; @Scripts.RenderFormat("<script type=\"text/ja ...

  8. .net core i上 K8S(二)运行简单.netcore程序

    上一章我们搭建了k8s集群,这一章我们开始在k8s集群上运行.netcore程序 1.kubectl run 在我的Docker系列教程里,我曾往docker hub中推送过一个镜像“webdokce ...

  9. JavaScript作用域详解

         作用域在JavaScript中是非常重要的概念,理解了它对更深入地理解闭包等概念都有很大的帮助,这篇文章就来谈谈我对作用域的理解. 一.全局作用域与局部作用域       在JavaScri ...

  10. 【08】循序渐进学 docker:docker compose

    写在前面的话 在之前的操作中,即使是单个容器每次都需要敲很长的命令,当需要多个容器组合着用的时候更加麻烦,此时我们急需找到一种一次配置,随便运行的方法. 这就是这一节重点,单机容器编排工具:docke ...