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方法写动画
let animation3Func = function() {
// do something...
// 需要执行自调用来执行动画效果
self.animalId3 = window.requestAnimationFrame(animation3Func);
};
self.animalId3 = window.requestAnimationFrame(animation3Func);
//清除这个动画效果
window.cancelAnimationFrame(this.animalId3);Vue使用clipboard(将指定数据存储到剪贴板)
使用clipboard 2全局注册
全局注册时用法
使用clipboard局部组件注册
Vue脚手架搭建的项目无法热更新解决方法
本节来源:vue项目无法热更新的解决办法
修改vue.config.js
Vue项目build时移除console.log
1. 第一种方法
安装
babel-plugin-transform-remove-console修改
babel.config.js文件
2. 第二种方法
1.安装 terser-webpack-plugin 2.修改 vue.config.js 文件
VS Code调试vue代码
本节来源:vscode调试代码
vscode安装Debugger for Chrome扩展修改 vue.config.js
按F5 选择
Chorme生成配置文件。替换配置文件。
如果提示
Can't find Chrome,需要配置runtimeExecutable为浏览器可执行文件路径。如果浏览器白屏并且
vscode提示Cannot connect to the target,则需配置userDataDir为true.
vue2 Element-UI 按需引入
1. 安装插件
2. 编辑.babelrc
.babelrcLast updated
Was this helpful?