popoverItem.vue 488 B

1234567891011121314151617181920212223
  1. <template>
  2. <li>
  3. <a @click="dispatchToStore" v-if="item.href" :href="(item.href) ? item.href : '#' ">
  4. <span :class="item.icon"></span>
  5. <span>{{item.text}}</span>
  6. </a>
  7. <button @click="dispatchToStore(item.action)" v-else>
  8. <span :class="item.icon"></span>
  9. <span>{{item.text}}</span>
  10. </button>
  11. </li>
  12. </template>
  13. <script>
  14. export default {
  15. props: ['item'],
  16. methods: {
  17. dispatchToStore () {
  18. this.$store.dispatch(this.item.action, this.item.data);
  19. }
  20. }
  21. }
  22. </script>