fix popover handling

This commit is contained in:
Miao Wang 2024-04-09 17:39:37 +08:00
parent 8abf91aa01
commit 5855a7e573
2 changed files with 11 additions and 6 deletions

View File

@ -38,7 +38,9 @@
<tr v-for="mir in filteredMirrorList" :class="['row', 'status-'+mir.status]" :key="mir.name">
<td class="col-8 col-lg-7 col-xl-8">
<a class="mirror-item-label" data-bs-toggle="popover" data-bs-trigger="hover" data-bs-placement="right"
:data-bs-content="mir.description" :href="getURL(mir)" :aria-label="mir.name + ', ' + mir.description">
:data-bs-content="mir.description" :href="getURL(mir)" :aria-label="mir.name + ', ' + mir.description"
v-with-popover
>
{{mir.name}}
</a>
<span class="badge badge-new" v-if='mir.is_new'>new</span>

View File

@ -98,11 +98,14 @@ onMounted(() => {
});
});
onUpdated(() => {
Array.from(document.getElementsByClassName("mirror-item-label")).map((el) => {
new BootStrapPopover(el);
});
});
const vWithPopover = {
mounted: (el) => {
BootStrapPopover.getOrCreateInstance(el);
},
beforeUnmount: (el) => {
BootStrapPopover.getInstance(el)?.dispose();
},
};
const sortAndUniqMirrors = (mirs) => {
mirs.sort((a, b) => {