uform一些小知识
1...uform绑定回车事件
<Field
type="string"
title="机柜编号"
name="cabinet_no"
default=''
x-effect={dispatch => ({
onPressEnter(e) {
dispatch('onChangeOption')
props.refreshTable()
}
})}
/>
2...uform重置表单
action.reset()
3...uform设置field是arrary里面的值
$('onSearchUser', 'select_contract_arr.*.receiverUser')
.pipe(
map(fieldState => {
console.log(fieldState);
return fieldState
}),
debounceTime(400)
)
.subscribe(async ({ payload, path }) => {
console.log(payload, path);
if (!payload) {
return;
}
this.setState({
path: path
})
let params = {
data: {
searchKey: payload
},
method: 'POST',
}
let res = await api.user.getAllUser(params)
if (res.code == 200) {
let userList = res.data.map(({ id, staff_name, department }) => ({ value: staff_name, label: `${staff_name} (${department})` }))
setFieldState(path.join('.'), state => {
state.loading = false
state.props.enum = userList
})
}
})
}
4、uform的placeholder
type: "textArea",
title: "描述",
required: true,
'x-props':{placeholder:'111'}