1、使用ref获取组件
<base-form ref="baseFormComponents"></base-form>
const baseFormComponents = ref(null)
2、defineExpose出需要使用的方法
const submit = (e) => {form1.value.validate(valid => {if (valid) {uni.showToast({title: "验证通过",icon: 'none'});console.log('验证通过');} else {console.log('验证失败');}});}defineExpose({submit})
3、使用
const formSubmit = () => {if (baseFormComponents.value) {baseFormComponents.value.submit()} else {console.log("baseFormComponents is undefined.");}};