You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
838 B

import {Component} from '../../vues6.js'
import {ActionService} from '../service/Action.service.js'
const template = `
<span v-if="!format || format === 'main'">
<a v-if="action.overall" :class="'btn btn-icon-split btn-' + action.color" href="#" @click="onClick">
<span class="icon text-white-50">
<i :class="'fas ' + action.icon"></i>
</span>
<span class="text">{{ action.title }}</span>
</a>
</span>
`
export class ActionButtonComponent extends Component {
static get selector() { return 'cobalt-action-button' }
static get template() { return template }
static get props() { return ['action', 'format'] }
async onClick() {
if ( this.action.defer ) {
return this.$emit('perform')
}
await ActionService.get().perform(this.action)
}
}