1、
<div>
<van-field
class="span_text"
:center="true"
v-model="productLineText"
is-link
label="产品线"
autocomplete="off"
@click="showPicker = true"
@focus="handleFocus"
/>
<van-popup v-model:show="showPicker" round position="bottom">
<Picker :columns="columns" @cancel="showPicker = false" @confirm="onConfirm" />
</van-popup>
</div>
const productLineText = ref('')
const showPicker = ref(false)
const columns = ref([])
const onConfirm = ({ selectedOptions }) => {
showPicker.value = false
productLineText.value = selectedOptions[0].text
}
//解决手机中选择器弹出键盘
const handleFocus = () => {
const activeElement = document.activeElement
if (activeElement) {
activeElement.blur()
}
}