-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
input type=nickname获取小程序昵称 #12020
Comments
taro-bot2
bot
added
F-vue3
Framework - Vue 3
T-weapp
Target - 编译到微信小程序
V-3
Version - 3.x
labels
Jun 30, 2022
可以用这个临时解法,不知啥时能修复 Taro.createSelectorQuery()
.select("#nickname-input")
.fields({
properties: ["value"],
})
.exec((res) => {
const nickname = res[0].value;
// 处理nickname
}); |
uniapp版本 uni.createSelectorQuery().in(this) // 注意这里要加上 in(this)
.select("#nickname-input")
.fields({
properties: ["value"],
})
.exec((res) => {
const nickName = res?.[0]?.value
console.log('昵称', nickName)
}) |
过去这么久了仍然是使用这个方法解决的,thx |
您好,请问修复了吗 |
楼上没有提供 Demo,简单模拟了一下,Taro 最新版本中并没有复现(iPhoneX): <template>
<view>
<input type="nickname" placeholder="nickname.." v-model="value" ref="inputRef">
<view><text>value: {{ value }}</text></view>
<button @tap="onClick">click me</button>
</view>
</template>
<script setup>
import Taro, { useReady } from '@tarojs/taro'
import { ref } from 'vue'
const value = ref('')
const inputRef = ref()
function onClick () {
console.log('ref: ', inputRef.value.value)
}
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
相关平台
微信小程序
小程序基础库: 2.24.6
使用框架: Vue 3
复现步骤
input设置了 type=nickname 并设置了v-model绑定,在小程序里通过快捷方便填入昵称以后绑定的值没有变化,改用ref去获取控件的value属性也是空
期望结果
小程序里通过快捷方式填入昵称,绑定的值同步变化
实际结果
小程序里通过快捷方式填入昵称,绑定的值没有变化
环境信息
The text was updated successfully, but these errors were encountered: