优化代码

This commit is contained in:
叶志超
2021-12-23 10:21:31 +08:00
parent 1aba962b06
commit b8b8a09e3d

View File

@@ -46,16 +46,14 @@ import { ref, computed, watch } from 'vue'
const show = ref(false)
// 表格数据更新时,滚动条回到最顶部
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)
// 表格数据更新时,滚动条回到最顶部
const satelliteTable = ref(null)
watch(satellites, () => {
if (satelliteTable.value) satelliteTable.value.scrollTop = 0
})
</script>
<style scoped>