<template>
  <div class="snapUpActivityContainer">
    <span class="option" @click="select(item.id)" v-for="(item, index) in options" :key="index" :class="{selected: item.id == selected}">
      {{item.label}} 
    </span>
    <!-- <Button type="primary" @click="save">保存</Button> -->
  </div>
</template>
<script>
export default {
  props: {
    value: {
      type: String,
      default: "1"
    }
  },
  watch: {
    selected(val) {
      this.$emit('input', val);  
    }
  },
  methods: {
    select(id) {
      this.selected = id;
    }
  },
  data() {
    return {
      options: [
        {id: '1', label: '平铺'},
        {id: '2', label: '主次'}
      ],
      selected: 0
    }
  },
  created() {
    this.selected = this.value;
  }
}
</script>
<style scoped lang="less">
.option{
  cursor: pointer;
  border-radius: 4px;
  line-height:normal;
  display: inline-block;
  padding: 3px 5px;
  border: 1px solid #dddee1;
  margin: 0 2px;
  user-select: none;
  &.selected, &:hover{
    border-color: #57a3f3;
    box-shadow: 0px 0px 0px 2px rgb(45 140 240 / 20%)
  }
}
</style>
