vue-note

Vue DOM元素绑定动态style

:style="{ transform: 'translateY(-' + num1 + 'px)' }"

Vue dom元素绑定多个类名需要以数组的方式书写

:class="[item.colorAndBoxName,
         current1==item.id?'selected1':'',
         current2==item.id?'selected2':'',
         current3==item.id?'selected3':'']"

requestAnimationFrame方法写动画

RAF参考教程

let animation3Func = function() {
    // do something...
    // 需要执行自调用来执行动画效果
    self.animalId3 = window.requestAnimationFrame(animation3Func);
  };
self.animalId3 = window.requestAnimationFrame(animation3Func);
//清除这个动画效果
window.cancelAnimationFrame(this.animalId3);

Vue使用clipboard(将指定数据存储到剪贴板)

git地址

使用clipboard 2全局注册

全局注册时用法

使用clipboard局部组件注册

Vue脚手架搭建的项目无法热更新解决方法

本节来源:vue项目无法热更新的解决办法

修改vue.config.js

Vue项目build时移除console.log

本节来源:build时移除console.log()代码

1. 第一种方法

  1. 安装 babel-plugin-transform-remove-console

  2. 修改 babel.config.js 文件

2. 第二种方法

1.安装 terser-webpack-plugin 2.修改 vue.config.js 文件

VS Code调试vue代码

本节来源:vscode调试代码

  1. vscode 安装 Debugger for Chrome 扩展

  2. 修改 vue.config.js

  1. 按F5 选择 Chorme 生成配置文件。

  2. 替换配置文件。

  1. 如果提示 Can't find Chrome ,需要配置 runtimeExecutable 为浏览器可执行文件路径。

  2. 如果浏览器白屏并且 vscode 提示 Cannot connect to the target,则需配置 userDataDirtrue.

vue2 Element-UI 按需引入

1. 安装插件

2. 编辑.babelrc

Last updated

Was this helpful?