<template>
	<uv-swipe-action>
		<view
		v-for="(item, index) in list"
		class="item"
		:key="item.id"
		>
			<uv-swipe-action-item 
			@click="e => clickSwipeAction(e, item)"
			:options="options">
				<workItem :item="keyName ? item[keyName] : item"/>
			</uv-swipe-action-item>
		</view>
	</uv-swipe-action>
</template>

<script>
	import workItem from './workItem.vue'
	export default {
		components : {
			workItem
		},
		props : {
			options : {
				default : [
					{
						text: '删除',
						style: {
							backgroundColor: '#FA5A0A'
						}
					}, 
				],
			},
			list : {
				default : []
			},
			keyName : {}
		},
		data() {
			return {
				
			}
		},
		methods: {
			clickSwipeAction(e, item){
				this.$emit('clickSwipeAction', {e, item})
			},
		}
	}
</script>

<style scoped lang="scss">
	.item{
		margin: 20rpx;
		border-radius: 20rpx;
		overflow: hidden;
	}
</style>
