【发布时间】:2020-07-04 12:11:31
【问题描述】:
我在 iOS 13 上使用 NativeScript ("nativescript-vue": "^2.5.0") 测试
"tns-android": {
"version": "6.0.0"
},
"tns-ios": {
"version": "6.0.1"
}
点击按钮时尝试将焦点设置在 TextField 上,目前看起来像这样
<GridLayout dock="top" columns="auto,*,auto" width="70%" rows="auto,auto">
<Label text.decode="" horizontalAlignment="left" row="0" rowSpan="2" col="0" />
<Label text="USER" horizontalAlignment="left" row="0" col="1" class="m-l-3" />
<Label :text="userEditBtnText" @tap="userEditTap()" horizontalAlignment="right" row="0" rowSpan="2" col="2" class="btnEdit"/>
<TextField ref="userid" text="@username" :editable="userEdit" horizontalAlignment="left" row="1" col="1" class="m-l-3"/>
</GridLayout>
以及@tap="userEditTap()" 的代码
userEditTap(){
this.userEdit = true;
this.userEditBtnText="SAVE";
this.$refs["userid"].focus();
}
我的控制台错误:
JavaScript 错误:文件: node_modules/@nativescript/core/application/application.ios.js:312:26 JS ERROR 错误:NativeScript 遇到致命错误:TypeError: this.$refs["userid"].focus 不是函数。 (在 'this.$refs["userid"].focus()', 'this.$refs["userid"].focus' 是 未定义)
感谢任何意见!
【问题讨论】:
标签: javascript vue.js nativescript nativescript-vue