xy 2 years ago
parent 186080fdf9
commit 7a587bd700

@ -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">

Loading…
Cancel
Save