|
|
|
|
@ -33,7 +33,7 @@
|
|
|
|
|
<script setup>
|
|
|
|
|
import { useUserStore } from "@/store/user"
|
|
|
|
|
import { useNoticeStore } from "@/store/notice"
|
|
|
|
|
import { ref,reactive,computed,onMounted,nextTick } from 'vue';
|
|
|
|
|
import { ref, reactive, computed, onMounted, nextTick, onUpdated } from 'vue';
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const noticeStore = useNoticeStore()
|
|
|
|
|
@ -41,15 +41,26 @@ const total = ref(0)
|
|
|
|
|
const notices = computed(() => noticeStore.notice['notice'])
|
|
|
|
|
const loading = ref(false)
|
|
|
|
|
const table = ref(null)
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
await nextTick()
|
|
|
|
|
|
|
|
|
|
const toDataUrl = (el) => {
|
|
|
|
|
window.open(`${el.getAttribute('data-url')}?auth_token=${userStore.authToken}`, '_blank');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onUpdated(async () => {
|
|
|
|
|
await nextTick();
|
|
|
|
|
table.value.$el.querySelectorAll("[data-url]").forEach(el => {
|
|
|
|
|
el.addEventListener('click', () => {
|
|
|
|
|
console.log(`${el.getAttribute('data-url')}?auth_token=${userStore.authToken}`)
|
|
|
|
|
window.open(`${el.getAttribute('data-url')}?auth_token=${userStore.authToken}`,'_blank')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
// 移除之前可能添加的监听器
|
|
|
|
|
if (el._clickHandler) {
|
|
|
|
|
el.removeEventListener("click", el._clickHandler);
|
|
|
|
|
}
|
|
|
|
|
// 创建一个新的监听器并存储在元素上
|
|
|
|
|
el._clickHandler = () => {
|
|
|
|
|
toDataUrl(el);
|
|
|
|
|
};
|
|
|
|
|
// 添加新的监听器
|
|
|
|
|
el.addEventListener('click', el._clickHandler);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|