更新依赖

This commit is contained in:
lyswhut
2023-10-25 14:22:41 +08:00
parent 1ff6a00653
commit 0c6cedf879
7 changed files with 535 additions and 492 deletions
@@ -22,27 +22,33 @@
/>
</template>
<script setup lang="ts">
<script setup>
import { watch, shallowReactive, ref } from '@common/utils/vueTools'
import { getBoardsList, setBoard } from '@renderer/store/leaderboard/action'
import { boards, type Board } from '@renderer/store/leaderboard/state'
import { boards } from '@renderer/store/leaderboard/state'
import useMenu from './useMenu'
import { useRouter, useRoute } from '@common/utils/vueRouter'
const props = defineProps<{
source: LX.OnlineSource
boardId?: string
}>()
const props = defineProps({
source: {
type: String,
required: true,
},
boardId: {
type: [String, undefined],
default: undefined,
},
})
const emit = defineEmits(['show-menu'])
const router = useRouter()
const route = useRoute()
const list = shallowReactive<Board['list']>([])
const list = shallowReactive([])
const rightClickItemIndex = ref(-1)
const handleToggleList = (id: string) => {
const handleToggleList = (id) => {
void router.replace({
path: route.path,
query: {
@@ -60,11 +66,11 @@ const {
menuClick,
} = useMenu({ emit, list })
const handleRigthClick = (event: MouseEvent, index: number) => {
const handleRigthClick = (event, index) => {
rightClickItemIndex.value = index
showMenu(event, index)
}
const handleMenuClick = (action?: { action: string }) => {
const handleMenuClick = (action) => {
if (rightClickItemIndex.value < 0) return
let index = rightClickItemIndex.value
rightClickItemIndex.value = -1
@@ -20,25 +20,34 @@
</div>
</template>
<script setup lang="ts">
<script setup>
import { watch, shallowReactive, ref, onMounted, onBeforeUnmount, computed, reactive } from '@common/utils/vueTools'
import { setTags, getTags } from '@renderer/store/songList/action'
import { tags, type TagInfoTypeItem } from '@renderer/store/songList/state'
import { tags } from '@renderer/store/songList/state'
import { useRouter, useRoute } from '@common/utils/vueRouter'
import { useI18n } from '@renderer/plugins/i18n'
const props = defineProps<{
source: LX.OnlineSource
tagId: string
sortId?: string
}>()
const props = defineProps({
source: {
type: String,
required: true,
},
tagId: {
type: String,
required: true,
},
sortId: {
type: [String, undefined],
default: undefined,
},
})
const router = useRouter()
const route = useRoute()
const t = useI18n()
const list = shallowReactive<TagInfoTypeItem[]>([])
const handleToggleTag = (id: string) => {
const list = shallowReactive([])
const handleToggleTag = (id) => {
void router.replace({
path: route.path,
query: {
@@ -77,18 +86,18 @@ const popupStyle = reactive({
const setTagPopupWidth = () => {
window.setTimeout(() => {
const dom_view = document.getElementById('view')
popupStyle.width = dom_view!.clientWidth * 0.96 + 'px'
popupStyle.maxHeight = dom_view!.clientHeight * 0.65 + 'px'
popupStyle.width = dom_view.clientWidth * 0.96 + 'px'
popupStyle.maxHeight = dom_view.clientHeight * 0.65 + 'px'
}, 50)
}
const dom_btn = ref<HTMLElement | null>(null)
const popupVisible = ref(false)
const handleShow = () => popupVisible.value = !popupVisible.value
const handleHide = (evt?: MouseEvent) => {
const handleHide = (evt) => {
// if (e && e.target.parentNode != this.$refs.dom_popup && this.show) return this.show = false
// console.log(this.$refs)
if (evt && (evt.target == dom_btn.value || dom_btn.value?.contains(evt.target as HTMLElement))) return
if (evt && (evt.target == dom_btn.value || dom_btn.value?.contains(evt.target))) return
setTimeout(() => {
popupVisible.value = false
}, 50)