2020-03-12 15:53:52 +00:00
|
|
|
<template>
|
|
|
|
<a
|
|
|
|
v-if="isLink"
|
|
|
|
:key="action.uri"
|
|
|
|
class="action-button button"
|
|
|
|
:href="action.uri"
|
2020-04-10 11:12:37 +00:00
|
|
|
target="_blank"
|
|
|
|
rel="noopener nofollow noreferrer"
|
2020-03-12 15:53:52 +00:00
|
|
|
>
|
|
|
|
{{ action.text }}
|
|
|
|
</a>
|
|
|
|
<button
|
|
|
|
v-else
|
|
|
|
:key="action.payload"
|
|
|
|
class="action-button button"
|
|
|
|
@click="onClick"
|
|
|
|
>
|
|
|
|
{{ action.text }}
|
|
|
|
</button>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
components: {},
|
|
|
|
props: {
|
|
|
|
action: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
isLink() {
|
|
|
|
return this.action.type === 'link';
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onClick() {
|
|
|
|
// Do postback here
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
@import '~widget/assets/scss/variables.scss';
|
|
|
|
@import '~dashboard/assets/scss/mixins.scss';
|
|
|
|
|
|
|
|
.action-button {
|
2020-04-10 11:12:37 +00:00
|
|
|
align-items: center;
|
2020-03-12 15:53:52 +00:00
|
|
|
border-radius: $space-micro;
|
2020-04-10 11:12:37 +00:00
|
|
|
display: flex;
|
2020-03-12 15:53:52 +00:00
|
|
|
font-weight: $font-weight-medium;
|
2020-04-10 11:12:37 +00:00
|
|
|
justify-content: center;
|
|
|
|
margin-top: $space-smaller;
|
|
|
|
max-height: 34px;
|
|
|
|
padding: 0;
|
|
|
|
width: 100%;
|
2020-03-12 15:53:52 +00:00
|
|
|
}
|
|
|
|
</style>
|