<template>
  <!-- 选择地点 -->
  <main-page
    left-arrow
    @click-left="$router.go(-1)"
  >
    <div class="pt-14 px-4 pb-16">
      <div v-for="(tag,index) in tags" :key="index" class="rounded">
        <div class="border-b pl-2.5 pr-1 w-full py-2.5 flex items-center bg-white rounded" :class="classBorder(index)" @click="clickIcon(index)">
          <app-icon
            slot="icon"
            :icon-name="checked === index+'' ? 'radio-checked': 'radio'"
            class-name="w-4 h-4 mr-2 flex items-center"
          />
          <div class="text-sm">
            {{ tag.condition }}
          </div>
        </div>
      </div>
    </div>
  </main-page>
</template>

<script lang="ts">
import Vue from 'vue'
import { Icon } from 'vant'

Vue.use(Icon)
export default Vue.extend({
  name: 'OAccessibility',
  components: {
    'main-page': () => import('@/layout/main-page.vue'),
    'app-icon': () => import('@/components/common/Icon.vue')
  },
  data() {
    return {
      checked: '',
      tags: [
        { key: 'private', condition: '私有（仅OKR负责人和所有参与人可见）' },
        { key: 'public', condition: '公开' }
      ],
      count: 0
    }
  },
  computed: {

  },
  created() {
    // console.log(Mock, 'mock')

  },
  methods: {
    clickIcon(index:number) {
      this.count = this.tags.length
      if (this.checked === index + '') {
        this.checked = ''
      } else {
        this.checked = index + ''
      }
    },
    classBorder(index:number) {
      if (index === this.tags.length - 1) {
        return 'border-none '
      }
      if (index === 0) {
        return 'mt-3'
      }
    }

  }
})
</script>

<style lang="less" scoped>

</style>
