代码更新
This commit is contained in:
@@ -1,11 +1,7 @@
|
||||
<template>
|
||||
<view class="u-relative choose-haocai">
|
||||
<view class="input u-flex" @click="toggle">
|
||||
<!-- <view>
|
||||
<text v-if="modelValue">{{modelValue}}</text>
|
||||
<text v-else class="color-666">请选择</text>
|
||||
</view> -->
|
||||
<up-input @blur="blur" @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
|
||||
<up-input @change="filterHaocaiList" border="none" v-model="text" placeholder="请选择"></up-input>
|
||||
<up-icon :size="10" name="arrow-down-fill"></up-icon>
|
||||
</view>
|
||||
<view class="u-absolute" v-if="popShow">
|
||||
@@ -21,12 +17,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import { reactive, ref, watch, onMounted } from 'vue';
|
||||
const props = defineProps({
|
||||
listMap: {
|
||||
type: Object,
|
||||
@@ -48,15 +39,11 @@
|
||||
})
|
||||
let text = ref('')
|
||||
let popShow = ref(props.show)
|
||||
const emits = defineEmits(['update:show', 'close', 'confirm', 'update:modelValue','change'])
|
||||
const emits = defineEmits(['update:show', 'update:modelValue','change'])
|
||||
onMounted(() => {
|
||||
setText()
|
||||
})
|
||||
|
||||
function close() {
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
popShow.value = false
|
||||
}
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
})
|
||||
@@ -81,6 +68,10 @@
|
||||
popShow.value = !popShow.value
|
||||
}
|
||||
|
||||
/**
|
||||
* 耗材选择监听
|
||||
* @param {Object} e
|
||||
*/
|
||||
function filterHaocaiList(e) {
|
||||
if (e === '') {
|
||||
return $haocaiList.value = props.list
|
||||
@@ -88,9 +79,13 @@
|
||||
const arr = props.list.filter(v => v.conName.match(e))
|
||||
$haocaiList.value = arr
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 耗材选择确认
|
||||
* @param {Object} item
|
||||
* @param {Object} index
|
||||
*/
|
||||
function haocaiClick(item, index) {
|
||||
console.log(item);
|
||||
if (item.id != props.modelValue) {
|
||||
emits('update:modelValue', item.id)
|
||||
emits('change', item)
|
||||
@@ -98,14 +93,7 @@
|
||||
popShow.value = false
|
||||
}
|
||||
|
||||
function blur() {
|
||||
// setTimeout(()=>{
|
||||
// popShow.value = false
|
||||
// },100)
|
||||
}
|
||||
onMounted(() => {
|
||||
setText()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user