OptionButton.vue 557 Bytes
Newer Older
Nature's avatar
Nature committed
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
<template>
  <div :class="type" class="function">{{ text }}</div>
</template>

<script>
export default {
  name: 'OptionButton',
  props: {
    type: {
      type: String,
      default: 'warn',
    },
    text: {
      type: String,
      default: '删除',
    },
  },
  mounted () {
    this.$parent && this.$parent.optionItem.push(this)
  },
  destroyed () {
    this.$parent && this.$parent.optionItem.splice(this.$parent.optionItem.indexOf(this), 1)
  },
  methods: {
    buttonClick (e) {
      this.$emit('press', this.type)
    },
  },
}
</script>