// form-item 配置prop
prop="user.name"
// rules
rules: {'user.name': [message: "xxxxx",validator(rule, val, callback) {// val 就是user.name的值},]
}
如: 对象的sysUser.userName
<n-form ref="formRefuser" :model="modelUser" <n-form-item label="用户名" path="sysUser.userName"><n-input v-model:value="modelUser.sysUser.userName" @keydown.enter.prevent placeholder="用户名" /></n-form-item>
js对象—modelUser
//添加对象
const modelUser = ref<UserInfo>({sysUser: {userId: null,userName: "",nickName: "",email: "",phonenumber: "",sex: "",avatar: "",password: "",remark: ""},sysDepts: [],sysRoles: [],sysPosts: []
})