为了账号安全,请及时绑定邮箱和手机立即绑定

是的:字符串未定义

是的:字符串未定义

陪伴而非守候 2021-06-17 13:12:56
我最近开始与 Yup 合作,我的项目中有这个架构,我需要将参数从字符串更改为对象 {string, string}它是如何(正在工作):exports.schema = yup.object().shape({ destination: yup.string().required('required msg'), .....})我想成为的样子:exports.schema = yup.object().shape({destination: yup.object().shape({    name: string().required('required msg'),    id: string().default(null).nullable()  }).required('required msg'),....})但是在我更改对象后,我一直收到此错误:参考错误:未定义字符串我做错了什么?
查看完整描述

2 回答

?
慕的地6264312

TA贡献1817条经验 获得超6个赞

你错过了字符串之前


exports.schema = yup.object().shape({

destination: yup.object().shape({

    name: yup.string().required('required msg'),

    id: yup.string().default(null).nullable()

  }).required('required msg'),

....

})


查看完整回答
反对 回复 2021-06-18
  • 2 回答
  • 0 关注
  • 194 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信