23 lines
794 B
Vue
23 lines
794 B
Vue
<script setup lang="ts">
|
||
// click 回传原生 MouseEvent:可以读修饰键,也可以阻止默认行为
|
||
import { ref } from 'vue'
|
||
import { G3Button, G3Space } from '@g3soft/ui'
|
||
|
||
const last = ref('暂无')
|
||
|
||
function handleClick(event: MouseEvent) {
|
||
const withKey = event.ctrlKey || event.metaKey ? '(按住了 Ctrl/Cmd)' : ''
|
||
last.value = `点击${withKey} @ ${event.clientX},${event.clientY}`
|
||
}
|
||
</script>
|
||
|
||
<template>
|
||
<G3Space direction="vertical" :size="12" style="display: flex">
|
||
<G3Space :size="8">
|
||
<G3Button @click="handleClick">点我(可按住 Ctrl)</G3Button>
|
||
<G3Button type="outline" @click="handleClick">也是点我</G3Button>
|
||
</G3Space>
|
||
<span style="color: #6b7280; font-size: 13px">最近一次:{{ last }}</span>
|
||
</G3Space>
|
||
</template>
|