xy 2 years ago
parent 186080fdf9
commit 7a587bd700

@ -33,7 +33,7 @@
<script setup> <script setup>
import { useUserStore } from "@/store/user" import { useUserStore } from "@/store/user"
import { useNoticeStore } from "@/store/notice" 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 userStore = useUserStore()
const noticeStore = useNoticeStore() const noticeStore = useNoticeStore()
@ -41,15 +41,26 @@ const total = ref(0)
const notices = computed(() => noticeStore.notice['notice']) const notices = computed(() => noticeStore.notice['notice'])
const loading = ref(false) const loading = ref(false)
const table = ref(null) 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 => { table.value.$el.querySelectorAll("[data-url]").forEach(el => {
el.addEventListener('click', () => { //
console.log(`${el.getAttribute('data-url')}?auth_token=${userStore.authToken}`) if (el._clickHandler) {
window.open(`${el.getAttribute('data-url')}?auth_token=${userStore.authToken}`,'_blank') el.removeEventListener("click", el._clickHandler);
}) }
}) //
}) el._clickHandler = () => {
toDataUrl(el);
};
//
el.addEventListener('click', el._clickHandler);
});
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

Loading…
Cancel
Save