|
1
|
<template>
|
vben
authored
|
2
3
|
<div class="p-10">
<Alert message="点内外部触发事件" show-icon></Alert>
|
|
4
|
<ClickOutSide @clickOutside="handleClickOutside" class="flex justify-center mt-10">
|
nebv
authored
|
5
|
<div @click="innerClick" class="demo-box">
|
|
6
7
8
9
10
11
12
13
|
{{ text }}
</div>
</ClickOutSide>
</div>
</template>
<script lang="ts">
import { defineComponent, ref } from 'vue';
import { Alert } from 'ant-design-vue';
|
vben
authored
|
14
|
import { ClickOutSide } from '/@/components/ClickOutSide';
|
|
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
export default defineComponent({
components: { ClickOutSide, Alert },
setup() {
const text = ref('Click');
function handleClickOutside() {
text.value = 'Click Out Side';
}
function innerClick() {
text.value = 'Click Inner';
}
return { innerClick, handleClickOutside, text };
},
});
</script>
|
nebv
authored
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<style lang="less" scoped>
.demo-box {
display: flex;
width: 100%;
height: 300px;
font-size: 24px;
color: #fff;
background: #408ede;
border-radius: 10px;
justify-content: center;
align-items: center;
}
</style>
|