pagination_button.vue 841 字节
Newer Older
1
<script>
2
import { GlIcon } from '@gitlab/ui';
3 4 5 6
import { DESIGN_ROUTE_NAME } from '../../router/constants';

export default {
  components: {
7
    GlIcon,
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
  },
  props: {
    design: {
      type: Object,
      required: false,
      default: null,
    },
    title: {
      type: String,
      required: true,
    },
    iconName: {
      type: String,
      required: true,
    },
  },
  computed: {
    designLink() {
      if (!this.design) return {};

      return {
        name: DESIGN_ROUTE_NAME,
        params: { id: this.design.filename },
        query: this.$route.query,
      };
    },
  },
};
</script>

<template>
  <router-link
    :to="designLink"
    :disabled="!design"
    :class="{ disabled: !design }"
    :aria-label="title"
    class="btn btn-default"
  >
46
    <gl-icon :name="iconName" />
47 48
  </router-link>
</template>