-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
uniapp中 form-input 没有执行 handleRef #1166
Comments
参考以下例子在uniapp中通过 <template>
<div>
<!-- 绑定 DOM 元素的 ref -->
<input ref="myInput" />
<!-- 绑定子组件的 ref -->
<my-component ref="myComponent"></my-component>
</div>
</template>
<script>
import MyComponent from "./MyComponent.vue";
export default {
components: {
MyComponent
},
mounted() {
// 访问 DOM 元素的引用
this.$refs.myInput.focus();
// 访问组件实例的引用
this.$refs.myComponent.doSomething();
},
methods: {
doFocus() {
// 在方法中访问 DOM 元素的引用
this.$refs.myInput.focus();
},
doComponentAction() {
// 访问组件实例的引用
this.$refs.myComponent.doSomething();
}
}
};
</script> |
这样写之后绑定上了,感谢 |
这句代码:import { Form } from 'antd-mini/Form/form'; |
安装了antd-mini就可以这样引入了 |
像 mini中的表单: 我在unapp 引入: ` <script> import Form from '/wxcomponents/miniprogram_npm/antd-mini/Form/form.js'; export default { data() { return { href: 'https://uniapp.dcloud.io/component/README?id=uniui', form: null, } }, .... ` 运行时,提示如下问题: ![1724636735961](https://github.com/user-attachments/assets/f80a9e6f-80ff-42ea-a791-ef7ce7766098) 我现在不知道怎么处理了,有点尴尬 |
组件
form-input
基础库版本
设备机型
ide
手机系统
APP
uniapp 支付宝端
组件库版本
2.x
预期行为
复现步骤
在uniapp中使用form-input组件,handleRef这段代码没有执行,提交表单时获取的values也是空对象,请问是什么原因?是绑ref的方式不对吗
复现 demo
代码:
The text was updated successfully, but these errors were encountered: