Skip to content

Commit

Permalink
feat(DamageCalculator): fill skill buttons when select hero
Browse files Browse the repository at this point in the history
  • Loading branch information
rudnovd committed Apr 2, 2022
1 parent 11fa602 commit da75ded
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/components/DamageCalculator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
:key="`${sideName}-skill-${key}-buttons`"
:color="sideName"
:name="skill"
:value="side.hero.skills[key] || 0"
:levels="levels.slice(1, levels.length)"
@click="side.hero!.skills[key] = $event"
/>
Expand Down
13 changes: 11 additions & 2 deletions src/components/damageCalculator/SelectSkillButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<script lang="ts">
import type { BattleSide } from '@/models/Battle'
import type { Level } from '@/models/Level'
import { defineComponent, PropType, ref } from 'vue'
import { defineComponent, PropType, ref, watch } from 'vue'
export default defineComponent({
name: 'SelectSkillButtons',
Expand All @@ -38,10 +38,19 @@ export default defineComponent({
type: Array as PropType<Array<Level>>,
required: true,
},
value: {
type: Number,
required: true,
},
},
emits: ['click'],
setup(props, context) {
const selectedLevel = ref(0)
const selectedLevel = ref(props.value)
watch(
() => props.value,
(newValue) => (selectedLevel.value = newValue)
)
const onClick = (level: number) => {
if (level === selectedLevel.value) {
Expand Down

0 comments on commit da75ded

Please sign in to comment.