2.2k 2 分钟

# js 基础写法

// 增加
addItem: function () {
var n = this.signForm.signFormList ? this.signForm.signFormList.length + 1 : 1;
	this.signForm.signFormList.push({
	  title: '标题' + n,
	  require: false
	});
},
// 删除
removeItem: function (item) {
	const index = this.signForm.signFormList.indexOf(item);
	this.signForm.signFormList.splice(index, 1);
},
// 置顶
moveTop: function (item) {
	const index = this.signForm.signFormList.indexOf(item);
	if(index != 0){
	  this.signForm.signFormList.splice(index,1);
	  this.signForm.signFormList.splice(0,0,item);
	}
},
// 上移
moveUp: function (item) {
	const index = this.signForm.signFormList.indexOf(item);
	if(index != 0){
		this.signForm.signFormList.splice(index,1);
		this.signForm.signFormList.splice(index-1,0,item);
	}
},
// 下移
moveDown: function (item) {
	const index = this.signForm.signFormList.indexOf(item);
	const max = this.signForm.signFormList.length ;
	if(index != max){
	  this.signForm.signFormList.splice(index,1);
	  this.signForm.signFormList.splice(index+1,0,item);
	}
},

30k 27 分钟

# D3: Data-Driven Documents

D3 (或 D3.js) 是一个 JavaScript 库,用于使用 Web 标准可视化数据。 D3 帮助您使用 SVG,Canvas 和 HTML 使数据栩栩如生。 D3 将强大的可视化和交互技术与数据驱动的 DOM 操作方法相结合,为您提供现代浏览器的全部功能,并为您的数据设计正确的可视界面提供了自由。

# 官方资源

  • API Reference
  • Release Notes
  • Gallery
  • Examples
  • Wiki

467 1 分钟

# 1. 谷歌浏览器

添加自定义 class

<el-checkbox-group v-model="checkList">
             <el-checkbox class="checkbox"></el-checkbox>
</el-checkbox-group>
.checkbox{
    zoom: 200%;
}

如果发现有浏览器没有作用那就用下面的办法

245 1 分钟

必填项不带星号 form 标签中有 :rules = “rules” 表单项中有 prop 校验规则:{validator: validateCreditCode, trigger: ‘blur’} 把 required: true 去掉即可 拓展:(样式覆盖) /deep/ .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before &#123; content: ' '; width: 0px; margin-right: 0px;&#125;
4.4k 4 分钟

# # 数字转换 # 进制转换 将 10 进制转换成 n 进制,可以使用 toString (n) const toDecimal = (num, n = 10) => num.toString(n)// 假设数字 10 要转换成 2 进制toDecimal(10, 2) // '1010'将 n 进制转换成 10 进制,可以使用 parseInt (num, n) // 10 的 2 进制为 1010const toDecimalism = (num, n = 10) => parseInt(num, n)toDecimalism(1010, 2)# web #...