js字符串数组['1','2','3']转number

1
2
let arr = ['1','2','3'];
arr.split(',').map(Number);

数组常用方法

扩展运算符

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
let arr = [1, 2, 3];
let arr2 = [...arr]; //等同于 let arr2 = Array.from(arr);

let [a, b, c] = [1, 2, 3]; //a=1, b=2, c=3

let [ , , third] = ["foo", "bar", "baz"]; //third="baz"

let [head, ...tail] = [1, 2, 3, 4]; //head=1, tail=234

let [x, y, ...z] = ['a']; //x=a, y=undefined, z=[], 如果解构不成功,变量的值就等于undefined

let [x, y = 'b'] = ['a']; // x='a', y='b',解构赋值允许指定默

// 解构赋值超强
const {
form: { validateFields }
} = this;
validateFields((err, values) => {
if (!err) {
// eslint-disable-next-line no-console
console.log("Received values of form: ", values);
}
});

antd中的form表单initialValue导致数据不更新问题

前言

初步理解 : initialValue就是所谓的defaultValue,只会在第一次赋值的时候改变,却又有一些不同,因为 initialValue又会因其他改动而改变。 然而当获取的数据重新上来要渲染的时候 ,initialValue的值却又不改变,所以 让人觉得很是捉摸不透。

antd-vue中给table表格整行加点击事件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<a-table
:columns="columns"
:dataSource="data"
:loading="loading"
:pagination="pagination"
:rowKey="record => record.id"
@change="paginationChange"
bordered
:customRow="click" // 这个是重点,主要是给table添加属性的作用
>

// 内容

</a-table>
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×