This commit is contained in:
weipengfei 2024-04-01 18:03:13 +08:00
parent 40b6de6fe8
commit 3bb17db543
3 changed files with 23 additions and 10 deletions

View File

@ -11,10 +11,10 @@ const deleteOne = (index)=>{
list.value.splice(index,1) list.value.splice(index,1)
} }
const getList = ()=>{ const getList = (item)=>{
list = { list.value.push({
num: 1 num: 1
} })
} }
defineExpose({ defineExpose({

View File

@ -11,15 +11,22 @@ const props = defineProps({
const emit = defineEmits(['getStoreList']) const emit = defineEmits(['getStoreList'])
const bar_code = ref(''); const bar_code = ref('');
watch(bar_code, (val) => { watch(bar_code, (val, old) => {
emit('getStoreList', { console.log(val,old);
bar_code: val if(val.length - old.length>5) console.log('扫码枪输入');
}) // emit('getStoreList', {
// bar_code: val
// })
}) })
const loadMore = () => { const loadMore = () => {
console.log("loadMore"); console.log("loadMore");
}; };
const changeItem = (item)=>{
emit('changeItem', item)
}
</script> </script>
<template> <template>
@ -47,7 +54,7 @@ const loadMore = () => {
style="overflow: auto" style="overflow: auto"
> >
<el-space wrap :size="20"> <el-space wrap :size="20">
<div class="shop-item" v-for="(item, index) in storeList" :key="index"> <div class="shop-item" v-for="(item, index) in storeList" :key="index" @click="changeItem(item)">
<el-image <el-image
:src="item.image" :src="item.image"
></el-image> ></el-image>

View File

@ -8,6 +8,8 @@ import { storeListApi } from "@/api/store.js";
import { useUserStore } from "@/store/user.js"; import { useUserStore } from "@/store/user.js";
const pupopRef = ref(null); const pupopRef = ref(null);
const orderRef = ref(null);
const shopRef = ref(null);
const storeList = ref([]); const storeList = ref([]);
@ -26,6 +28,10 @@ const getStoreList = (data)=>{
} }
getStoreList(); getStoreList();
const changeItem = (item)=>{
orderRef.value.getList(item);
}
nextTick(() => { nextTick(() => {
// pupopRef.value.show(true); // pupopRef.value.show(true);
}) })
@ -35,9 +41,9 @@ nextTick(() => {
<template> <template>
<div class="my-card"> <div class="my-card">
<order /> <order ref="orderRef"/>
<padding /> <padding />
<shop style="flex: 1" :storeList="storeList" @getStoreList="getStoreList"/> <shop ref="shopRef" style="flex: 1" :storeList="storeList" @getStoreList="getStoreList" @changeItem="changeItem"/>
<pupop ref="pupopRef"/> <pupop ref="pupopRef"/>
</div> </div>
</template> </template>