提交 6001d8c1 编写于 作者: Y yurj26

feat(input): add auto focus

上级 fb05f608
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<view class="nvue-page-root"> <view class="nvue-page-root">
<page-head :title="title"></page-head> <page-head :title="title"></page-head>
<view class="uni-common-mt"> <view class="uni-common-mt">
<!-- <view class="uni-form-item uni-column"> <view class="uni-form-item uni-column">
<view class="title"><text class="uni-form-item__title">可自动聚焦的 input</text></view> <view class="title"><text class="uni-form-item__title">可自动聚焦的 input</text></view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input" :focus="true" placeholder="自动获得焦点" ref="input"/> <input class="uni-input" :focus="true" placeholder="自动获得焦点" ref="input"/>
</view> </view>
</view> --> </view>
<!-- #ifdef APP-PLUS --> <!-- #ifdef APP-PLUS -->
<!-- <view v-if="platform==='ios'&&!isNvue" class="uni-form-item uni-column"> <!-- <view v-if="platform==='ios'&&!isNvue" class="uni-form-item uni-column">
<view class="title"><text class="uni-form-item__title">隐藏 iOS 软键盘上的导航条</text></view> <view class="title"><text class="uni-form-item__title">隐藏 iOS 软键盘上的导航条</text></view>
...@@ -115,6 +115,9 @@ ...@@ -115,6 +115,9 @@
showPassword: true showPassword: true
} }
}, },
onReady() {
(this.$refs['input'] as INode).focus();
},
methods: { methods: {
onKeyInput: function (event : InputEvent) { onKeyInput: function (event : InputEvent) {
this.inputValue = event.detail.value this.inputValue = event.detail.value
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册