| 1 |
<template> |
| 2 |
<md-avatar v-if="plugin.icon" class="checkbox-avatar" :class="size"> |
| 3 |
<img :src="plugin.icon" :alt="plugin.Title" @error="replaceImage"> |
| 4 |
<md-tooltip md-direction="top">{{plugin.Title}}</md-tooltip> |
| 5 |
</md-avatar> |
| 6 |
<md-avatar class="md-avatar-icon checkbox-avatar md-accent" :class="size" v-else> |
| 7 |
{{plugin.Title.charAt(0)}} |
| 8 |
<md-tooltip md-direction="top">{{plugin.Title}}</md-tooltip> |
| 9 |
</md-avatar> |
| 10 |
</template> |
| 11 |
|
| 12 |
<script> |
| 13 |
import store from '@/store' |
| 14 |
import { mapState, mapMutations } from 'vuex' |
| 15 |
|
| 16 |
export default { |
| 17 |
name: 'plugin-avatar', |
| 18 |
store, |
| 19 |
props: { |
| 20 |
slug: { |
| 21 |
type: String |
| 22 |
}, |
| 23 |
size: { |
| 24 |
default: 'md-small', |
| 25 |
type: String |
| 26 |
} |
| 27 |
}, |
| 28 |
data () { |
| 29 |
return {} |
| 30 |
}, |
| 31 |
computed: { |
| 32 |
plugin () { |
| 33 |
return this.activeCase.all_suspects[this.slug] |
| 34 |
}, |
| 35 |
...mapState([ |
| 36 |
'activeCase' |
| 37 |
]) |
| 38 |
}, |
| 39 |
methods: { |
| 40 |
replaceImage () { |
| 41 |
this.removeImage(this.plugin.plugin_file) |
| 42 |
}, |
| 43 |
...mapMutations([ |
| 44 |
'removeImage' |
| 45 |
]) |
| 46 |
} |
| 47 |
} |
| 48 |
</script> |