ant Design 问题记录
1.点击行高亮
//html <table>部分
:customRow="customRow" :rowClassName="rowClassName"
data定义变量
clickIndex:''
//methods方法区 customRow(record, index){ return { on: { click: () => { this.clickIndex = index } } } },
rowClassName(record,index){
return index === this.clickIndex:'lightHeight':''
}
2.select下拉不生效
设置初始值时,赋值undefined或者[]
3.设置开始时间大于结束时间,且当日可选
//html <a-date-picker v-model="startDate" :disabledDate="optionstart" placeholder="开始时间"><a-date-picker> <a-date-picker v-model="endDate" :disabledDate="optionEnd" placeholder="结束时间"><a-date-picker> //methods optionEnd(current){ return current &¤t.valueOf()<Date.parse(this.startDate) } optionstart(current){ return current &¤t.valueOf()>Date.parse(this.endDate)+86400 }
4.form组件启用校验后不能使用v-model.赋值可使用 this.form.setFieldsValue({})
5.日期组件赋值报错,可引入moment组件
//引入组件,报错后执行npm i
import moment from 'moment' //methods添加方法,只写方法名既可 moment, //使用 this.dateStart = moment('2021-01-21')
6.table组件添加customRender后取不到行数据
若dataIndex值不为空,则row取值为dataIndex对应值,可设为空值用key代替
以前未深想,此间未重逢

浙公网安备 33010602011771号