定义一个响应式的数据和表单域规则:

// 数据
const modelRef = reactive({
name: ‘’,
region: undefined,
type: [],
});
// 表单域规则
const rulesRef = reactive({
name: [
{
required: true,
message: ‘Please input name’,
},
],
region: [
{
required: true,
message: ‘Please select region’,
},
],
type: [
{
required: true,
message: ‘Please select type’,
type: ‘array’,
},
],
});
// 数据
const modelRef = reactive({
  name: ‘’,
  region: undefined,
  type: [],
});
// 表单域规则
const rulesRef = reactive({
  name: [
    {
      required: true,
      message: ‘Please input name’,
    },
  ],
  region: [
    {
      required: true,
      message: ‘Please select region’,
    },
  ],
  type: [
    {
      required: true,
      message: ‘Please select type’,
      type: ‘array’,
    },
  ],
});

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页