<template>
  <div class='app-container'>
    <el-form>
      <el-form-item>
        <el-button type="primary" icon="Plus" plain @click="getDialog">新增</el-button>
      </el-form-item>
    </el-form>
    <!-- 列表 -->
    <el-table :data="data.tableData" v-loading="loading">
      <el-table-column type="selection" align="center"></el-table-column>
      <el-table-column label="分类ID" align="center"></el-table-column>
      <el-table-column label="分类名称" align="center"></el-table-column>
      <el-table-column label="当前状态" align="center"></el-table-column>
      <el-table-column label="创建时间" align="center"></el-table-column>
      <el-table-column label="操作" align="center">
        <template #default="scope">
          <el-button type="primary" link @click="getDialog">编辑</el-button>
          <el-button type="danger" link>删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 弹窗 -->
    <el-dialog v-model="dialogVisible" :title="title" width="500">
      <el-form>
        <el-form-item label="分类名称：">
          <el-input placeholder="请输入分类名称" />
        </el-form-item>
      </el-form>
      <template #footer>
        <el-button>取消</el-button>
        <el-button type="primary">确定</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
// 遮罩层
const loading = ref(false)

const data = reactive({
  form: {},
  tableData: [{}]
})

// 弹窗
const dialogVisible = ref(false)
const title = ref("新增")

function getDialog() {
  dialogVisible.value = true
}
</script>