<template>
	<view class="x-submit" @click="submitClick">
		<slot></slot>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isClick: true // 限制点击次数，只允许单次点击
			}
		},
		methods: {
			submitClick() {
				if (this.isClick) {
					this.isClick = false
					this.$emit('click', this.confirmClick)
				}
			},
			confirmClick(num = 0) {
				if (num > 0) {
					let timer = setTimeout(() => {
						this.isClick = true
					}, num)
				} else {
					this.isClick = true
				}
			}
		}
	}
</script>

<style>

</style>
