<template>
	<a-button @click="toEdit">编辑</a-button>
</template>

<script setup lang="ts">
	import { ref, onMounted, computed, defineProps, watch, defineEmits, createVNode } from 'vue';
	import { useCommon } from '@/hooks/useCommon';
	let { store, showEdit, hideEdit ,ExclamationCircleOutlined, Modal } = useCommon();

	const toEdit = () => {
		if (store.state.show_edit) {
			Modal.confirm({
				title: '有内容在进行编辑，是否要退出当前编辑',
				icon: createVNode(ExclamationCircleOutlined),
				content: '当前编辑内容不会保存',
				okText: '退出',
				cancelText: '取消',
				onOk() {
					hideEdit()
				},
				onCancel() {
					console.log('Cancel');
				},
			});
		} else {
			showEdit()
		}
	}

	// editModel = computed(() => {
	// 	return store.state.show_edit;
	// })
</script>


<style>
</style>