<template>
  <div class="subPage">
    <div class="system-table-box">
      <el-table
        :data="tags.list"
        stripe
        style="width: 100%">
        <el-table-column
          prop="TagName"
          label="标签名称">
        </el-table-column>
      </el-table>
    </div>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage"
      :page-size="tableSearch.pagesize"
      layout="prev, pager, next, jumper"
      :total="tags.pagenum">
    </el-pagination>
  </div>
</template>

<script>
import { createNamespacedHelpers } from 'vuex'

const { mapState: mapCourseTagState, mapActions: mapCourseTagActions } = createNamespacedHelpers('coursetag')

export default {
  name: '',
  data () {
    return {
      currentPage: 0, // 当前页码
      tableSearch: { // 表格搜索条件
        page: 1,
        pagesize: 10,
      },
    }
  },
  computed: {
    ...mapCourseTagState({
      tags: x => x.tagList,
    })
  },
  methods: {
    ...mapCourseTagActions([
      'GetCourseTagList',
    ]),
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`)
    },
    handleCurrentChange (val) {
      this.tableSearch.page = val
      this.getList()
    },
    getList () {
      this.GetCourseTagList(this.tableSearch)
    }
  },
  mounted () {
    this.getList()
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
</style>
