Rewrite Modals/Shortcut with composition API

This commit is contained in:
AkiraFukushima 2022-04-27 21:17:37 +09:00
parent d3cba0cebb
commit fef5f23166
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
1 changed files with 17 additions and 11 deletions

View File

@ -81,20 +81,26 @@
</div> </div>
</template> </template>
<script> <script lang="ts">
export default { import { defineComponent, computed } from 'vue'
import { useStore } from '@/store'
import { MUTATION_TYPES } from '@/store/TimelineSpace/Modals/Shortcut'
export default defineComponent({
name: 'shortcut', name: 'shortcut',
computed: { setup() {
shortcutModal: { const space = 'TimelineSpace/Modals/Shortcut'
get() { const store = useStore()
return this.$store.state.TimelineSpace.Modals.Shortcut.modalOpen const shortcutModal = computed({
}, get: () => store.state.TimelineSpace.Modals.Shortcut.modalOpen,
set(value) { set: (value: boolean) => store.commit(`${space}/${MUTATION_TYPES.CHANGE_MODAL}`, value)
this.$store.commit('TimelineSpace/Modals/Shortcut/changeModal', value) })
}
return {
shortcutModal
} }
} }
} })
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>