我正在使用 array().of 方法创建 Yup 验证模式,我需要根据外部模式对象的值在该数组中设置一些验证规则。我如何获得对该值的引用?
const termsSchema = Yup.object().shape({
termType: Yup.string().when('condition', {
is: true,
then: Yup.string()
.required('Type is required'),
}),
});
const schema = Yup.object().shape({
condition: Yup.boolean()
.required('Error'),
terms: Yup.array().of(termsSchema),
});
Run Code Online (Sandbox Code Playgroud) 我在模板字符串中添加 HTML 元素时遇到问题。我想在我的<li>元素中添加新行,但<br>被解释为字符串。
let movieDescription = document.createTextNode(`${moviesData[i].title} <br> ${moviesData[i].year} <br> ${moviesData[i].genre} <br>${moviesData[i].summary}`);
Run Code Online (Sandbox Code Playgroud)
如何<br>在模板字符串中添加元素?