<template>
  <div class="demo-table-theme">
    <div class="demo-box">
      <ui-radio-group
        v-model="currentTheme"
        :options="themeList"></ui-radio-group>
    </div>
    <ui-table
      :theme="currentTheme"
      :data-source="dataSource"
      :columns="columns"
      :on-click="onClick"></ui-table>
  </div>
</template>

<script>
import { Table, RadioGroup } from "amumu-ui"

const dataSource = [
  {
    id: "100001",
    title: "升级版本方案",
    status: "待处理",
    handler: "吴彦祖",
  },
  {
    id: "100002",
    title: "升级版本方案",
    status: "待处理",
    handler: "吴彦祖",
  },
  {
    id: "100003",
    title: "升级版本方案",
    status: "待处理",
    handler: "吴彦祖",
  },
]

const columns = [
  {
    title: "ID",
    key: "id",
  },
  {
    title: "标题",
    key: "title",
  },
  {
    title: "状态",
    key: "status",
  },
  {
    title: "处理人",
    key: "handler",
  },
]

export default {
  components: {
    "ui-table": Table,
    "ui-radio-group": RadioGroup,
  },
  data() {
    return {
      dataSource: dataSource,
      columns: columns,
      currentTheme: "horizontal-bordered",
      themeList: [
        "horizontal-bordered",
        "vertical-bordered",
        "bordered",
        "striped",
        "striped-bordered",
        "line",
      ].map(item => ({ label: item, value: item })),
    }
  },
  methods: {
    onClick() {
      console.log(arguments)
    },
  },
}
</script>

<style lang="scss">
.demo-table-theme {
  table {
    margin: 0;
  }

  th,
  td {
    border: none;
  }
}
</style>
