Files
DiceCloud/app/imports/ui/properties/components/attributes/HealthBarCardContainer.vue
2020-03-06 10:15:38 +02:00

50 lines
1012 B
Vue

<template lang="html">
<health-bar-card
:attributes="attributes"
@change="healthBarChanged"
@click="healthBarClicked"
/>
</template>
<script>
import CreatureProperties, { damageProperty } from '/imports/api/creature/CreatureProperties.js';
import HealthBarCard from '/imports/ui/properties/components/attributes/HealthBarCard.vue';
export default {
components: {
HealthBarCard,
},
props: {
charId: String,
},
meteor: {
attributes(){
return CreatureProperties.find({
'ancestor.id': this.charId,
type: 'attribute',
attributeType: 'healthBar',
value: {$ne: 0},
}, {
sort: {order: 1},
});
},
},
methods: {
healthBarClicked({_id}){
this.$store.commit('pushDialogStack', {
component: 'creature-property-dialog',
elementId: `${_id}`,
data: {_id},
});
},
healthBarChanged({_id, change}){
damageProperty.call({
_id,
operation: change.type,
value: change.value
});
},
},
};
</script>