feat: 添加全选/全不选功能及按钮文本更新

This commit is contained in:
jxxghp
2025-03-23 12:28:30 +08:00
parent 06b6c3f3cb
commit b7488214fc
3 changed files with 51 additions and 0 deletions

View File

@@ -84,6 +84,18 @@ const selectedSites = ref<number[]>([])
// 搜索菜单显示状态
const searchMenuShow = ref(false)
// 全选/全不选按钮文字
const checkAllText = computed(() => (selectedSites.value.length === allSites.value.length ? '全不选' : '全选'))
// 全选/全不选
function checkAllSitesorNot() {
if (selectedSites.value.length === allSites.value.length) {
selectedSites.value = []
} else {
selectedSites.value = allSites.value.map(item => item.id)
}
}
// 查询所有站点
async function querySites() {
try {
@@ -573,6 +585,11 @@ function onRemoveSubscribe() {
{{ site.name }}
</VChip>
</VChipGroup>
<div>
<VBtn size="small" variant="text" @click.stop="checkAllSitesorNot">
{{ checkAllText }}
</VBtn>
</div>
</VListItem>
<VListItem>
<VBtn @click="handleSearch" block>搜索</VBtn>