<template>
	<view class="page padding">
		<view class="padding bg-white radius flex justify-between margin-bottom" v-for="item in list" :key="item.id">
			<view>{{ item.name }}</view>
			<view>
				<button class="bg-blue cu-btn margin-right-xs" @click="edit()">编辑</button>
				<button class="bg-red cu-btn">删除</button>
			</view>
		</view>
		<button class="lg cuIcon-add bg-blue round margin-top-xl" @click="edit()">新增检查表</button>
	</view>
</template>

<script setup>
	import { ref } from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import { useRouter } from 'vue-router'
	import { getCheckTableList } from '@/request/api.js'
	const router = useRouter()
	const list = ref([])
	const edit = () => {
		uni.navigateTo({
			url: '/pages/editchecklist/editchecklist'
		})
	}
	onLoad(() => {
		getCheckTableList().then(res => {
			if (res.code === 0) {
				list.value = res.data.records
			}
		})
	})
	
</script>

<style lang="scss" scoped>
	.page {
		min-height: 100vh;
		background: #EBF2FC;
	}
</style>