<template>
	<view class="page">
    <view
        :class="[ 'single-company', { clicked: companyCount === index } ]"
        v-for="(item, index) in companyList"
        :key="item.id"
        @click="clickCompany(index)"
    >
      {{ item.name }}
    </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
        companyCount: '',
        companyList: [
          { id: 41, name: '测试单位' },
          { id: 42, name: '应急抢险技能实训场' },
          { id: 43, name: '云南送变电培训与评价中心' },
        ]
			}
		},
		methods: {
      clickCompany(count) {
        this.companyCount = count
      }
		},
    onNavigationBarButtonTap(e) {
      if (this.companyCount === '') {
        uni.showToast({
          icon: 'none',
          title: '请选择公司！'
        })
      } else {
        console.log(this.companyList[this.companyCount].id)
      }
    },
	}
</script>

<style lang="scss">

  .page{

    width: 100vw;
    height: 100vh;
    background-color: #F8F8F8;
    box-sizing: border-box;
    padding: 15rpx 0;

    .single-company{

      width: 100%;
      background-color: #fff;
      box-sizing: border-box;
      padding: 25rpx;
      margin-bottom: 10rpx;
      font-size: 14px;
      font-weight: bold;

    }

    .clicked{

      background-color: #ECF2F8;

    }

  }

</style>
