<template>
  <div class="home">
    <div class="banner">
      <img alt="Vue logo" style="width: 64px; height: 64px" src="../assets/logo.png">
      <h3 style="margin-top: 1rem">Welcome to Your Vue.js App</h3>
    </div>

    <br/>

    <h2># Ellipsis 组件 </h2>

    <a-divider> Ellipsis </a-divider>
    <a-card style="margin-bottom: 3rem">
      <ellipsis :length="100" tooltip>
        There were injuries alleged in three cases in 2015, and a
        fourth incident in September, according to the safety recall report. After meeting with US regulators in October, the firm decided to issue a voluntary recall.
      </ellipsis>
    </a-card>

    <h2># TagSelect 组件 </h2>

    <a-divider> TagSelect </a-divider>
    <a-card style="margin-bottom: 3rem">
      <tag-select>
        <tag-select-option value="cat1">类目1</tag-select-option>
        <tag-select-option value="cat2">类目2</tag-select-option>
        <tag-select-option value="cat3">类目3</tag-select-option>
        <tag-select-option value="cat4">类目4</tag-select-option>
        <tag-select-option value="cat5">类目5</tag-select-option>
        <tag-select-option value="cat6">类目6</tag-select-option>
        <tag-select-option value="cat7">类目7</tag-select-option>
      </tag-select>
    </a-card>

    <h2># DescriptionList 组件 </h2>

    <a-divider> DescriptionList </a-divider>
    <a-card style="margin-bottom: 3rem">
      <description-list title="组名称" size="small">
        <description-list-item term="负责人">林东东</description-list-item>
        <description-list-item term="角色码">1234567</description-list-item>
        <description-list-item term="所属部门">XX公司-YY部</description-list-item>
        <description-list-item term="过期时间">2018-08-08</description-list-item>
        <description-list-item term="描述">这段描述很长很长很长很长很长很长很长很长很长很长很长很长很长很长...</description-list-item>
      </description-list>
    </a-card>

    <a-divider> TagCloud </a-divider>
    <a-card style="margin-bottom: 3rem">
      <tag-cloud :tag-list="tagCloudData"></tag-cloud>
    </a-card>
  </div>
</template>

<script>
// @ is an alias to /src

import Ellipsis from '@/components/Ellipsis'
import TagSelect from '@/components/TagSelect'
import { DescriptionList, TagCloud } from '@/components/'

const TagSelectOption = TagSelect.Option

const DescriptionListItem = DescriptionList.Item

export default {
  name: 'Home',
  components: {
    Ellipsis,
    TagSelect,
    TagSelectOption,
    TagCloud,
    DescriptionList,
    DescriptionListItem
  },
  data () {
    return {
      tagCloudData: []
    }
  },
  created () {
    this.getTagCloudData()
  },
  methods: {
    getTagCloudData () {
      this.$http.get('/data/antv/tag-cloud').then(res => {
        this.tagCloudData = res.result
      })
    }
  }
}
</script>

<style scoped>
  .home {
    width: 900px;
    margin: 0 auto;
    padding: 25px 0;
  }
  .home > .banner {
    text-align: center;
    padding: 25px 0;
    margin: 25px 0;
  }
</style>
