<template>
  <router-link
    v-test-id="'button-link'"
    v-data-element:button="{ dataElement }"
    :to="to">
    <el-button v-bind="{ ...$attrs, ...$props, to: undefined }" v-on="$listeners">
      <slot v-if="$slots.default"></slot>
    </el-button>
  </router-link>
</template>

<script>
/**
 * A router-link that looks like a button.
 */

export default {
  name: 'BcButtonLink',

  props: {
    to: {
      type: [String, Object],
      required: true
    },
    dataElement: String
  },

  methods: {
    handleClick(e) {
      this.$emit('click', e);
    }
  }
};
</script>

