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)
}
const getList = ()=>{
list = {
const getList = (item)=>{
list.value.push({
num: 1
}
})
}
defineExpose({

View File

@ -11,15 +11,22 @@ const props = defineProps({
const emit = defineEmits(['getStoreList'])
const bar_code = ref('');
watch(bar_code, (val) => {
emit('getStoreList', {
bar_code: val
})
watch(bar_code, (val, old) => {
console.log(val,old);
if(val.length - old.length>5) console.log('扫码枪输入');
// emit('getStoreList', {
// bar_code: val
// })
})
const loadMore = () => {
console.log("loadMore");
};
const changeItem = (item)=>{
emit('changeItem', item)
}
</script>
<template>
@ -47,7 +54,7 @@ const loadMore = () => {
style="overflow: auto"
>
<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
:src="item.image"
></el-image>

View File

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