<template>
	<view>
		<SearchShopListItem v-for="item in searchInfoList" :key="searchid" :shopInfo="item" :show-style="showStyle"
			:isEdit="isEdit" @delItem="handleDel" @updateItem="handleUpdate"></SearchShopListItem>
	</view>
</template>

<script>
	/**
	 * @property  {Number}   showStyle        展示商铺的样式类型(0为首页默认)
	 * @property  {Boolean}  isEdit   		是否显示编辑和删除
	 * @property  {Number}    listType         获取列表类型传递参数部分
	 * @property  {Object}    customQuery      自定义查询参数
	 */
	export default {
		name: "SearchShopList",
		data() {
			return {
				pageSize: 5,
				pageNum: 1,
			};
		},
		props: {
			searchInfoList: {
				type: Array,
				default () {
					return []
				}
			},
			showStyle: {
				type: Number,
				default () {
					return 0
				}
			},
			isEdit: {
				type: Boolean,
				default () {
					return false
				}
			},
			listType: {
				type: Number,
				default () {
					return 2
				}
			},
			customQuery: {
				type: Object,
				default () {
					return {}
				}
			}
		},
		methods: {
			handleUpdate(searchid) {
				this.$emit('updateItem', searchid)
			},
			handleDel(shopid) {
				console.log("删除了商铺", shopid);
				this.$emit('delItem', shopid)
				// const delindex = this.shopInfoList.findIndex((item,index)=> item.shopid === shopid)
				// TODO：不能直接修改
				// if(delindex !== -1)  this.shopInfoList = this.shopInfoList.slice(delindex,1)
				// console.log(this.shopInfoList);
			}
		}
	}
</script>

<style lang="scss">

</style>