naive-ui/demo/documentation/components/collapse/enUS/itemHeaderClick.demo.md
07akioni 487001d697 build: add changelog to site, refactor loader based on suffix
.demo.md for component demo
.demo-entry.md for demo entry
.md for common docs
2020-08-19 23:30:04 +08:00

759 B

Click on Item Header

<n-collapse
  v-model="activeNames"
  @item-header-click="handleItemHeaderClick"
>
  <n-collapse-item name="1">
    <template v-slot:header>
      Bronze
    </template>
    <div>Okay</div>
  </n-collapse-item>
  <n-collapse-item name="2">
    <template v-slot:header>
      Silver
    </template>
    <div>Good</div>
  </n-collapse-item>
  <n-collapse-item name="3">
    <template v-slot:header>
      Gold
    </template>
    <div>Excellent</div>
  </n-collapse-item>
</n-collapse>
export default {
  data () {
    return {
      activeNames: []
    }
  },
  methods: {
    handleItemHeaderClick ({
      name,
      expanded
    }) {
      this.$NMessage.info(`Name: ${name}, Expanded: ${expanded}`)
    }
  }
}