base.js 933 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // import { mapGetters } from "vuex";
  2. export default {
  3. name: 'v-base',
  4. props: {
  5. options: {
  6. type: Object,
  7. default: () => {
  8. return {};
  9. },
  10. },
  11. },
  12. methods: {
  13. click(link) {
  14. /* let isLink = ['string', 'number'].indexOf(typeof link) == -1;
  15. if(!isLink || !link || link=="0" ) return;
  16. const event = link;
  17. link = this.options.link;
  18. if(link) {
  19. event.stopPropagation();
  20. }
  21. if(!link || link =="0") return; */
  22. let event;
  23. if (!['string', 'number'].includes(typeof link)) {
  24. event = link;
  25. link = this.options.link;
  26. }
  27. if (!link || link === '0') return;
  28. event?.stopPropagation();
  29. this.$router.push({
  30. name: 'page',
  31. params: {
  32. id: link,
  33. },
  34. });
  35. },
  36. getComponent(node, def) {
  37. return node.type ? `v-${node.type}` : def ? `v-${def}` : 'div';
  38. },
  39. },
  40. };