Blame view

src/views/example/components/Dropdown/Platform.vue 1.05 KB
d7d9c38c2   Adam   auto commit the c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  <template>
    <el-dropdown :hide-on-click="false" :show-timeout="100" trigger="click">
      <el-button plain>
        Platfroms({{ platforms.length }})
        <i class="el-icon-caret-bottom el-icon--right" />
      </el-button>
      <el-dropdown-menu slot="dropdown" class="no-border">
        <el-checkbox-group v-model="platforms" style="padding: 5px 15px;">
          <el-checkbox v-for="item in platformsOptions" :key="item.key" :label="item.key">
            {{ item.name }}
          </el-checkbox>
        </el-checkbox-group>
      </el-dropdown-menu>
    </el-dropdown>
  </template>
  
  <script>
  export default {
    props: {
      value: {
        required: true,
        default: () => [],
        type: Array
      }
    },
    data() {
      return {
        platformsOptions: [
          { key: 'a-platform', name: 'a-platform' },
          { key: 'b-platform', name: 'b-platform' },
          { key: 'c-platform', name: 'c-platform' }
        ]
      }
    },
    computed: {
      platforms: {
        get() {
          return this.value
        },
        set(val) {
          this.$emit('input', val)
        }
      }
    }
  }
  </script>