优化store

This commit is contained in:
叶志超
2021-12-23 11:16:54 +08:00
parent b8b8a09e3d
commit c92438a210
8 changed files with 42 additions and 63 deletions

View File

@@ -44,16 +44,16 @@ import { useStore } from 'vuex'
import { ref, computed, watch } from 'vue'
const show = ref(false)
const show = ref(false)
const store = useStore()
const satellites = computed(() => store.getters["satelliteSystem/satellites"])
const onTrackButtonClicked = id => store.dispatch('satelliteSystem/track', id)
const onShowStateCheckboxChanged = id => store.dispatch('satelliteSystem/toggleShow', id)
// 表格数据更新时,滚动条回到最顶部
const satelliteTable = ref(null)
watch(satellites, () => satelliteTable.value.scrollTop = 0)
const store = useStore()
const satellites = computed(() => store.state.satellites.all)
const onTrackButtonClicked = id => store.commit('satellites/track', id)
const onShowStateCheckboxChanged = id => store.commit('satellites/toggleShow', id)
</script>
<style scoped>