我有一个我定义的对象
js
文件。我想让这个物体看起来有点像,但更漂亮的会改变它。
以下是我希望它的外观:
const validationSchema = Yup.object().shape({
name: Yup
.string('Enter a name')
.required('Name is required'),
email: Yup
.string('Enter your email')
.email('Enter a valid email')
.required('Email is required'),
password: Yup
.string('')
.min(8, 'Password must contain at least 8 characters')
.required('Enter your password'),
confirmPassword: Yup
.string('Enter your password')
.required('Confirm your password')
.oneOf([Yup.ref('password')], 'Password does not match'),
})
下面是更漂亮的改革:
const validationSchema = Yup.object().shape({
name: Yup.string('Enter a name').required('Name is required'),
email: Yup.string('Enter your email')
.email('Enter a valid email')
.required('Email is required'),
password: Yup.string('')
.min(8, 'Password must contain at least 8 characters')
.required('Enter your password'),
confirmPassword: Yup.string('Enter your password')
.required('Confirm your password')
.oneOf([Yup.ref('password')], 'Password does not match'),
})
有什么我可以做的,以表明漂亮保持我的格式?如果是,怎么做?