优化代码,并删除长按10秒退出的功能,因为浏览器不支持了
parent
c95ae24140
commit
93a12decbf
|
@ -1,37 +1,19 @@
|
|||
<template>
|
||||
<div v-show="!!src">
|
||||
<img @mouseup="onMouseUp" @mousedown="onMouseDown" :src="src">
|
||||
</div>
|
||||
<div v-show="!!src">
|
||||
<img :src="src">
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref } from 'vue'
|
||||
export default defineComponent({
|
||||
setup: () => {
|
||||
const src = ref('/image/flag/Beidou.png')
|
||||
const show_flag = (flag_name) => {
|
||||
if (!flag_name) return
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue'
|
||||
|
||||
src.value = './image/flag/' + flag_name + '.png'
|
||||
}
|
||||
const src = ref('')
|
||||
const show_flag = (flag_name: string) => {
|
||||
if (!flag_name) return
|
||||
|
||||
let exit_timeout = null
|
||||
const exit = () => {
|
||||
window.opener = window;
|
||||
window.open('', '_self', '');
|
||||
window.close();
|
||||
}
|
||||
const onMouseUp = () => {
|
||||
if (exit_timeout) clearTimeout(exit_timeout)
|
||||
}
|
||||
|
||||
const onMouseDown = () => {
|
||||
exit_timeout = setTimeout(exit, 10000)
|
||||
}
|
||||
|
||||
return { src, show_flag, onMouseUp, onMouseDown }
|
||||
}
|
||||
})
|
||||
src.value = './image/flag/' + flag_name + '.png'
|
||||
}
|
||||
defineExpose({ show_flag })
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue