@neatui/nuxt 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/package.json +43 -0
- package/rollup.config.js +35 -0
- package/src/components/basic/IDraggable.vue +84 -0
- package/src/components/basic/IDraggable@b.vue +80 -0
- package/src/components/basic/IFollowView.vue +211 -0
- package/src/components/basic/IPickerView.vue +351 -0
- package/src/components/basic/IRouterView.vue +360 -0
- package/src/components/basic/IScrollView.vue +127 -0
- package/src/components/basic/Icon.vue +54 -0
- package/src/components/basic/LayerView/Layer.vue +339 -0
- package/src/components/basic/LayerView/index.ts +5 -0
- package/src/components/basic/index.ts +7 -0
- package/src/components/display/Avatar.vue +1 -0
- package/src/components/display/Badge.vue +1 -0
- package/src/components/display/Calendar.vue +245 -0
- package/src/components/display/CalendarReg.vue +245 -0
- package/src/components/display/Card.vue +1 -0
- package/src/components/display/Carousel.vue +1 -0
- package/src/components/display/ChartView.vue +123 -0
- package/src/components/display/Collapse.vue +1 -0
- package/src/components/display/Desriptions.vue +1 -0
- package/src/components/display/Empty.vue +1 -0
- package/src/components/display/Image.vue +112 -0
- package/src/components/display/List.vue +1 -0
- package/src/components/display/PhotoEditor.vue +181 -0
- package/src/components/display/PhotoViewer.vue +50 -0
- package/src/components/display/Popover.vue +1 -0
- package/src/components/display/QRCode.vue +1 -0
- package/src/components/display/Segmented.vue +1 -0
- package/src/components/display/Statistic.vue +1 -0
- package/src/components/display/Table.vue +1 -0
- package/src/components/display/Tabs.vue +1 -0
- package/src/components/display/Tag.vue +1 -0
- package/src/components/display/Timeline.vue +1 -0
- package/src/components/display/Tooltip.vue +1 -0
- package/src/components/display/Tour.vue +1 -0
- package/src/components/display/Tree.vue +431 -0
- package/src/components/display/TreeView.vue +225 -0
- package/src/components/display/index.ts +8 -0
- package/src/components/form/Cascader.vue +435 -0
- package/src/components/form/DatePicker.vue +124 -0
- package/src/components/form/DateRangePicker@v2.vue.backup +224 -0
- package/src/components/form/DateRangePicker@v3.vue +116 -0
- package/src/components/form/DateRangeView@v3.vue +386 -0
- package/src/components/form/DateView.vue +229 -0
- package/src/components/form/DateView@v2.vue +386 -0
- package/src/components/form/DateView@v3.vue +471 -0
- package/src/components/form/EditUpload.vue +4 -0
- package/src/components/form/ImgUpload.vue +174 -0
- package/src/components/form/Input.vue.backup +230 -0
- package/src/components/form/Input@v3.vue +267 -0
- package/src/components/form/InputNumber.vue +200 -0
- package/src/components/form/InputRange.vue +235 -0
- package/src/components/form/MoreSelect.vue.backup +144 -0
- package/src/components/form/MoreSelect@v3.vue +195 -0
- package/src/components/form/MoreSelectList.vue +125 -0
- package/src/components/form/MoreSelectPanel@v3.vue +190 -0
- package/src/components/form/MoreSelectPicker.vue +124 -0
- package/src/components/form/MoreSelectTags.vue +124 -0
- package/src/components/form/PageMoreSelect.vue +187 -0
- package/src/components/form/PageSelect.vue +189 -0
- package/src/components/form/SearchMoreSelect.vue +173 -0
- package/src/components/form/SearchSelect.vue.backup +194 -0
- package/src/components/form/SearchSelect@v3.vue +202 -0
- package/src/components/form/Select@v3.vue +201 -0
- package/src/components/form/SelectList.vue +58 -0
- package/src/components/form/SelectPicker.vue +97 -0
- package/src/components/form/SelectTags.vue +52 -0
- package/src/components/form/SelectTree/SelectTree@v1.vue +227 -0
- package/src/components/form/Switch.vue +135 -0
- package/src/components/form/TextArea.vue +193 -0
- package/src/components/form/TimePicker.vue +11 -0
- package/src/components/form/TimeView.vue +244 -0
- package/src/components/form/Upload.vue +346 -0
- package/src/components/form/index.ts +82 -0
- package/src/components/loader/FormLoader/FormLoader@v2.vue +422 -0
- package/src/components/loader/FormLoader/FormLoader@v3.vue.backup +318 -0
- package/src/components/loader/FormLoader/index.ts +2 -0
- package/src/components/loader/FormLoader@v1/FormLoader.vue +506 -0
- package/src/components/loader/FormLoader@v1/FormRender.vue +277 -0
- package/src/components/loader/LimitLoader/LimitLoader.vue.backup +131 -0
- package/src/components/loader/LimitLoader/LimitLoader@v2.vue.backup +174 -0
- package/src/components/loader/LimitLoader/LimitLoader@v3.vue +183 -0
- package/src/components/loader/LimitLoader/index.ts +2 -0
- package/src/components/loader/TableLoader/TableColView.vue +115 -0
- package/src/components/loader/TableLoader/TableLoader.vue +360 -0
- package/src/components/loader/TableLoader/index.ts +2 -0
- package/src/components/loader/ViewLoader/ViewLoader@v1.vue +256 -0
- package/src/components/loader/ViewLoader/index.ts +2 -0
- package/src/components/loader/index.ts +5 -0
- package/src/components/tools/FormDraftsView.vue +330 -0
- package/src/components/tools/FormVerifyView.vue +206 -0
- package/src/components/tools/MoreTools.vue +74 -0
- package/src/components/tools/MoreTools@v2.vue +74 -0
- package/src/components/tools/Pagination@a.vue +222 -0
- package/src/components/tools/Pagination@b.vue +221 -0
- package/src/components/tools/index.ts +5 -0
- package/src/index.ts +9 -0
- package/src/shims-vue.d.ts +5 -0
- package/src/store/myui.ts +50 -0
- package/tsconfig.json +24 -0
package/README.md
ADDED
package/package.json
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
{
|
2
|
+
"name": "@neatui/nuxt",
|
3
|
+
"version": "0.1.0",
|
4
|
+
"description": "basic component ui",
|
5
|
+
"main": "./src/index.ts",
|
6
|
+
"license": "MIT",
|
7
|
+
"author": "xiaojunbo",
|
8
|
+
"peerDependencies": {
|
9
|
+
"vue": "^3.2.0"
|
10
|
+
},
|
11
|
+
"scripts": {
|
12
|
+
"build": "rollup -c rollup.config.js"
|
13
|
+
},
|
14
|
+
"devDependencies": {
|
15
|
+
"@rollup/plugin-typescript": "^11.1.6",
|
16
|
+
"postcss-scss": "^4.0.9",
|
17
|
+
"rollup-plugin-scss": "^4.0.0",
|
18
|
+
"rollup-plugin-terser": "^7.0.2",
|
19
|
+
"typescript": "^5.1.6"
|
20
|
+
},
|
21
|
+
"dependencies": {
|
22
|
+
"@fekit/floor": "^2.2.2",
|
23
|
+
"@fekit/follow": "^1.0.10",
|
24
|
+
"@fekit/itable": "^1.1.6",
|
25
|
+
"@fekit/pullload": "^1.3.5",
|
26
|
+
"@fekit/scale": "^2.0.1",
|
27
|
+
"@fekit/scrollto": "^3.0.3",
|
28
|
+
"@fekit/toast": "^2.2.3",
|
29
|
+
"@fekit/url": "^2.0.1",
|
30
|
+
"@fekit/utils": "^2.10.21",
|
31
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
32
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
33
|
+
"@vue/compiler-sfc": "^3.4.30",
|
34
|
+
"compressorjs": "^1.2.1",
|
35
|
+
"echarts": "^5.5.0",
|
36
|
+
"rollup": "^4.18.0",
|
37
|
+
"rollup-plugin-postcss": "^4.0.2",
|
38
|
+
"rollup-plugin-vue": "^6.0.0",
|
39
|
+
"swiper": "^11.0.4",
|
40
|
+
"vue-cropper": "^0.6.4",
|
41
|
+
"vuedraggable": "^4.1.0"
|
42
|
+
}
|
43
|
+
}
|
package/rollup.config.js
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
const resolve = require('@rollup/plugin-node-resolve');
|
2
|
+
const commonjs = require('@rollup/plugin-commonjs');
|
3
|
+
const vue = require('rollup-plugin-vue');
|
4
|
+
const postcss = require('rollup-plugin-postcss');
|
5
|
+
const typescript = require('@rollup/plugin-typescript');
|
6
|
+
const { terser } = require('rollup-plugin-terser');
|
7
|
+
const scss = require('postcss-scss');
|
8
|
+
|
9
|
+
module.exports = {
|
10
|
+
input: 'src/components/loader/index.ts',
|
11
|
+
output: {
|
12
|
+
file: 'dist/bundle.js',
|
13
|
+
format: 'es'
|
14
|
+
},
|
15
|
+
plugins: [
|
16
|
+
resolve({
|
17
|
+
extensions: ['.js', '.ts', '.vue']
|
18
|
+
}),
|
19
|
+
commonjs(),
|
20
|
+
vue({
|
21
|
+
css: false,
|
22
|
+
compileTemplate: true
|
23
|
+
}),
|
24
|
+
postcss({
|
25
|
+
extensions: ['.css', '.scss'],
|
26
|
+
extract: true,
|
27
|
+
minimize: true,
|
28
|
+
syntax: scss
|
29
|
+
}),
|
30
|
+
typescript({
|
31
|
+
tsconfig: './tsconfig.json'
|
32
|
+
}),
|
33
|
+
terser()
|
34
|
+
]
|
35
|
+
};
|
@@ -0,0 +1,84 @@
|
|
1
|
+
<template>
|
2
|
+
<ul>
|
3
|
+
<li
|
4
|
+
v-for="(item, idx) in list || []"
|
5
|
+
:key="idx"
|
6
|
+
class="pr drag-page-move n-sm"
|
7
|
+
draggable="true"
|
8
|
+
@dragstart.self="fMoveSta($event, list, idx)"
|
9
|
+
@dragend.self="fMoveEnd($event, list, idx)"
|
10
|
+
@dragenter.self="fMoveInt($event, list, idx)"
|
11
|
+
@dragover.prevent="fMoveIng($event)"
|
12
|
+
@dragleave="fMoveOut($event)"
|
13
|
+
>
|
14
|
+
<slot :item="item" :idx="idx">{{ item.label }}</slot>
|
15
|
+
</li>
|
16
|
+
</ul>
|
17
|
+
</template>
|
18
|
+
|
19
|
+
<script setup lang="ts">
|
20
|
+
import { reactive, PropType } from 'vue';
|
21
|
+
const props = defineProps({
|
22
|
+
list: {
|
23
|
+
type: Array as PropType<any[]>,
|
24
|
+
default: () => []
|
25
|
+
}
|
26
|
+
});
|
27
|
+
const state: any = reactive({});
|
28
|
+
|
29
|
+
// 按下
|
30
|
+
const fMoveSta = (e: any, arr: any, idx: any) => {
|
31
|
+
state.__page_moveing = 1;
|
32
|
+
state.__page_moveStaNode = { e, arr, idx };
|
33
|
+
};
|
34
|
+
// 移动
|
35
|
+
const fMoveIng = (e: any) => {
|
36
|
+
if (state.__page_moveing) {
|
37
|
+
const _h = e?.target?.getBoundingClientRect()?.height || 0;
|
38
|
+
const _v = _h / 2 > 0 ? _h / 2 : 0;
|
39
|
+
state.__page_moveEndNodeIsNext = e?.layerY > _v ? 1 : 0;
|
40
|
+
console.log(40, e, _v, e?.layerY > _v ? 'next' : 'prev');
|
41
|
+
e?.target?.setAttribute('data-ins', e?.layerY > _v ? 'next' : 'prev');
|
42
|
+
}
|
43
|
+
};
|
44
|
+
// 移入
|
45
|
+
const fMoveInt = (e: any, arr: any, idx: any, page: any = '') => {
|
46
|
+
if (state.__page_moveing) {
|
47
|
+
state.__page_moveEndNode = { e, arr, idx, page };
|
48
|
+
}
|
49
|
+
};
|
50
|
+
// 移出
|
51
|
+
const fMoveOut = (e: any) => {
|
52
|
+
if (state.__page_moveing) {
|
53
|
+
e?.target?.removeAttribute('data-ins');
|
54
|
+
}
|
55
|
+
};
|
56
|
+
// 松开
|
57
|
+
const fMoveEnd = (_e: any, arr: any, i2: any) => {
|
58
|
+
if (state.__page_moveing) {
|
59
|
+
if (state.__page_moveEndNode) {
|
60
|
+
const [item] = arr.splice(i2, 1);
|
61
|
+
let idx = state.__page_moveEndNode?.idx || 0;
|
62
|
+
if (state.__page_moveEndNodeIsNext && i2 >= idx) {
|
63
|
+
idx = idx + 1;
|
64
|
+
}
|
65
|
+
if (!state.__page_moveEndNodeIsNext && i2 < idx) {
|
66
|
+
idx = idx - 1;
|
67
|
+
}
|
68
|
+
state.__page_moveEndNode?.arr?.splice(idx, 0, item);
|
69
|
+
fMoveOut(state.__page_moveEndNode?.e);
|
70
|
+
}
|
71
|
+
state.__page_moveing = 0;
|
72
|
+
}
|
73
|
+
};
|
74
|
+
</script>
|
75
|
+
<style lang="scss">
|
76
|
+
.drag-page-move {
|
77
|
+
&[data-ins='prev'] {
|
78
|
+
box-shadow: inset 0 1px 0 0 #000;
|
79
|
+
}
|
80
|
+
&[data-ins='next'] {
|
81
|
+
box-shadow: inset 0 -1px 0 0 #000;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
</style>
|
@@ -0,0 +1,80 @@
|
|
1
|
+
<template>
|
2
|
+
<ul ref="aaa">
|
3
|
+
<li
|
4
|
+
v-for="(item, idx) in list || []"
|
5
|
+
:key="idx"
|
6
|
+
style="user-select: none"
|
7
|
+
class="drag-move-item b-solid bk-line b-xs n-sm"
|
8
|
+
:data-move-ing="state.__moveing"
|
9
|
+
@mousedown="fMoveSta($event, list, idx)"
|
10
|
+
@mousemove="fMoveIng($event, list, idx)"
|
11
|
+
@mouseup="fMoveEnd($event, list, idx)"
|
12
|
+
@mouseleave="fMoveOut($event, list, idx)"
|
13
|
+
>
|
14
|
+
{{ item.label }}
|
15
|
+
</li>
|
16
|
+
</ul>
|
17
|
+
</template>
|
18
|
+
|
19
|
+
<script setup lang="ts">
|
20
|
+
import { reactive, ref, PropType } from 'vue';
|
21
|
+
const props = defineProps({
|
22
|
+
list: {
|
23
|
+
type: Array as PropType<any[]>,
|
24
|
+
default: () => []
|
25
|
+
}
|
26
|
+
});
|
27
|
+
const state: any = reactive({
|
28
|
+
__moveing: 0,
|
29
|
+
__x: 0,
|
30
|
+
__y: 0
|
31
|
+
});
|
32
|
+
|
33
|
+
const aaa: any = ref(null);
|
34
|
+
|
35
|
+
// class Drag {
|
36
|
+
// constructor(el: any) {}
|
37
|
+
// }
|
38
|
+
|
39
|
+
// 按下
|
40
|
+
const fMoveSta = (e: any, arr: any, idx: any) => {
|
41
|
+
console.log('sta', e, idx);
|
42
|
+
state.__moveing = 1;
|
43
|
+
state.__x = e.clientX;
|
44
|
+
state.__y = e.clientY;
|
45
|
+
state.__e = e.target;
|
46
|
+
// state.__e.style.pointerEvents = 'none';
|
47
|
+
};
|
48
|
+
// 移动
|
49
|
+
const fMoveIng = (e: any, arr: any, idx: any) => {
|
50
|
+
if (state.__moveing) {
|
51
|
+
// const deltaX = e.clientX - state.__x;
|
52
|
+
// const deltaY = e.clientY - state.__y;
|
53
|
+
// state.__e.style.transform = `translate(${deltaX}px, ${deltaY}px)`;
|
54
|
+
if (e.target !== state.__e) {
|
55
|
+
const _h = e?.target?.getBoundingClientRect()?.height || 0;
|
56
|
+
const _v = _h / 2 > 0 ? _h / 2 : 0;
|
57
|
+
state.__moveEndNodeIsNext = e?.layerY > _v ? 1 : 0;
|
58
|
+
e?.target?.setAttribute('data-ins', e?.layerY > _v ? 'next' : 'prev');
|
59
|
+
}
|
60
|
+
}
|
61
|
+
};
|
62
|
+
const fMoveEnd = (e: any, arr: any, i2: any) => {
|
63
|
+
if (state.__moveing) {
|
64
|
+
e?.target?.removeAttribute('data-ins');
|
65
|
+
}
|
66
|
+
state.__moveing = 0;
|
67
|
+
};
|
68
|
+
const fMoveOut = (e: any, arr: any, idx: any) => {
|
69
|
+
e?.target?.removeAttribute('data-ins');
|
70
|
+
};
|
71
|
+
</script>
|
72
|
+
<style lang="scss">
|
73
|
+
.drag-move-item {
|
74
|
+
position: relative;
|
75
|
+
transition: all 250ms;
|
76
|
+
&[data-move-ing~='1'] {
|
77
|
+
transition: all 50ms;
|
78
|
+
}
|
79
|
+
}
|
80
|
+
</style>
|
@@ -0,0 +1,211 @@
|
|
1
|
+
<template>
|
2
|
+
<div ref="dom" :class="btnClass" :style="btnStyle" @click="toggle" @mouseover="hovershow" @mouseout="hoverhide">
|
3
|
+
<slot>
|
4
|
+
<button ui-btn="@a s case :border"><i class="icon icon-dropdown"></i></button>
|
5
|
+
</slot>
|
6
|
+
</div>
|
7
|
+
<Teleport to="#ifollow" v-if="$slots.tips">
|
8
|
+
<div
|
9
|
+
ref="tip"
|
10
|
+
:class="tipClass"
|
11
|
+
:style="`position: fixed; pointer-events: none; ${tipStyle}`"
|
12
|
+
ui-tips="@a"
|
13
|
+
:ui-tips-view="state.show ? 1 : 0"
|
14
|
+
@mouseover="hovershow"
|
15
|
+
@mouseout="hoverhide"
|
16
|
+
>
|
17
|
+
<div ref="box" :ui-tips-box="state.pos" :class="tipBoxClass" :style="tipBoxStyle" @mousedown="downdom">
|
18
|
+
<slot name="tips"></slot>
|
19
|
+
<div v-if="arrow" ui-tips-arrow="" v-bind="arrow"></div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</Teleport>
|
23
|
+
</template>
|
24
|
+
<script setup lang="ts">
|
25
|
+
import { reactive, ref, onMounted, onUnmounted, watch } from 'vue';
|
26
|
+
import Follow from '@fekit/follow';
|
27
|
+
|
28
|
+
const emits = defineEmits(['update:modelValue', 'onhide', 'onshow']);
|
29
|
+
|
30
|
+
const area: any = document.querySelector('#ifollow');
|
31
|
+
if (!area) {
|
32
|
+
const el = document.createElement('div');
|
33
|
+
el.id = 'ifollow';
|
34
|
+
document.body.appendChild(el);
|
35
|
+
}
|
36
|
+
|
37
|
+
// 类型
|
38
|
+
interface Props {
|
39
|
+
modelValue?: string | number;
|
40
|
+
pos?: string;
|
41
|
+
event?: string;
|
42
|
+
btnClass?: string;
|
43
|
+
btnStyle?: string;
|
44
|
+
tipClass?: string;
|
45
|
+
tipStyle?: string;
|
46
|
+
tipBoxClass?: string;
|
47
|
+
tipBoxStyle?: string;
|
48
|
+
arrow?: any;
|
49
|
+
}
|
50
|
+
|
51
|
+
// 入参
|
52
|
+
const props: any = withDefaults(defineProps<Props>(), {
|
53
|
+
modelValue: 0,
|
54
|
+
pos: 'bl',
|
55
|
+
event: 'click',
|
56
|
+
btnClass: 'dib',
|
57
|
+
btnStyle: 'dib',
|
58
|
+
tipClass: '',
|
59
|
+
tipStyle: '',
|
60
|
+
tipBoxClass: '',
|
61
|
+
tipBoxStyle: '',
|
62
|
+
arrow: {}
|
63
|
+
});
|
64
|
+
|
65
|
+
const dom: any = ref(null);
|
66
|
+
const tip: any = ref(null);
|
67
|
+
const box: any = ref(null);
|
68
|
+
const state = reactive({
|
69
|
+
view: 0,
|
70
|
+
show: 0,
|
71
|
+
pos: props.pos,
|
72
|
+
hover: 0,
|
73
|
+
tipdom: false
|
74
|
+
});
|
75
|
+
|
76
|
+
const showTimer: any = ref(null);
|
77
|
+
const hideTimer: any = ref(null);
|
78
|
+
watch(
|
79
|
+
() => state.hover,
|
80
|
+
() => {
|
81
|
+
clearTimeout(showTimer.value);
|
82
|
+
clearTimeout(hideTimer.value);
|
83
|
+
if (state.hover) {
|
84
|
+
showTimer.value = setTimeout(() => {
|
85
|
+
state.show = 1;
|
86
|
+
}, 100);
|
87
|
+
} else {
|
88
|
+
hideTimer.value = setTimeout(() => {
|
89
|
+
state.show = 0;
|
90
|
+
}, 100);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
);
|
94
|
+
|
95
|
+
// 开关
|
96
|
+
const toggle = () => {
|
97
|
+
if (props.event === 'click') {
|
98
|
+
state.show = state.show ? 0 : 1;
|
99
|
+
}
|
100
|
+
};
|
101
|
+
|
102
|
+
watch(
|
103
|
+
[() => state.show, () => state.hover],
|
104
|
+
() => {
|
105
|
+
if (state.show) {
|
106
|
+
emits('onshow');
|
107
|
+
} else {
|
108
|
+
emits('onhide');
|
109
|
+
}
|
110
|
+
emits('update:modelValue', state.show);
|
111
|
+
},
|
112
|
+
{ deep: true }
|
113
|
+
);
|
114
|
+
|
115
|
+
const hovershow = () => {
|
116
|
+
if (props.event === 'hover') {
|
117
|
+
state.hover = 1;
|
118
|
+
}
|
119
|
+
};
|
120
|
+
|
121
|
+
const hoverhide = () => {
|
122
|
+
if (props.event === 'hover') {
|
123
|
+
state.hover = 0;
|
124
|
+
}
|
125
|
+
};
|
126
|
+
|
127
|
+
const show = () => {
|
128
|
+
state.show = 1;
|
129
|
+
};
|
130
|
+
|
131
|
+
const hide = () => {
|
132
|
+
state.show = 0;
|
133
|
+
};
|
134
|
+
|
135
|
+
// 取消
|
136
|
+
const cancel = ({ target }: any = {}) => {
|
137
|
+
if (tip.value && !state.tipdom && !tip.value?.contains(target) && dom.value && !dom.value.contains(target) && !tip.value.querySelector('input:focus')) {
|
138
|
+
state.show = 0;
|
139
|
+
}
|
140
|
+
};
|
141
|
+
|
142
|
+
const downdom = (ev: any) => {
|
143
|
+
// 不记得了这个当时为什么要加上这个,这个会影响单选框的选中后不自动关闭下拉框啊~
|
144
|
+
// state.tipdom = true;
|
145
|
+
// document.addEventListener(
|
146
|
+
// 'mouseup',
|
147
|
+
// () => {
|
148
|
+
// setTimeout(() => {
|
149
|
+
// state.tipdom = false;
|
150
|
+
// }, 10);
|
151
|
+
// },
|
152
|
+
// true
|
153
|
+
// );
|
154
|
+
};
|
155
|
+
|
156
|
+
onMounted(() => {
|
157
|
+
document.addEventListener('click', cancel, true);
|
158
|
+
});
|
159
|
+
|
160
|
+
const ex: any = ref(null);
|
161
|
+
watch([() => dom.value, () => tip.value], () => {
|
162
|
+
if (dom.value && tip.value) {
|
163
|
+
ex.value = new Follow(dom.value, tip.value, (status) => {
|
164
|
+
if (!props?.pos?.includes(':fixed')) {
|
165
|
+
if (status === 'b') {
|
166
|
+
const _pos = props?.pos?.replace(/b/g, 't');
|
167
|
+
if (_pos) {
|
168
|
+
state.pos = _pos;
|
169
|
+
}
|
170
|
+
} else {
|
171
|
+
const _pos = props?.pos?.replace(/t/g, 'b');
|
172
|
+
if (_pos) {
|
173
|
+
state.pos = _pos;
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
});
|
178
|
+
} else {
|
179
|
+
ex.value = null;
|
180
|
+
}
|
181
|
+
});
|
182
|
+
|
183
|
+
onUnmounted(() => {
|
184
|
+
document.removeEventListener('click', cancel, true);
|
185
|
+
state.show = 0;
|
186
|
+
|
187
|
+
if (ex.value) {
|
188
|
+
ex.value.remove();
|
189
|
+
}
|
190
|
+
});
|
191
|
+
|
192
|
+
watch(
|
193
|
+
() => state.show,
|
194
|
+
(show: any) => {
|
195
|
+
if (ex.value) {
|
196
|
+
if (show) {
|
197
|
+
ex.value.listen();
|
198
|
+
} else {
|
199
|
+
ex.value.remove();
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
);
|
204
|
+
|
205
|
+
defineExpose({
|
206
|
+
toggle,
|
207
|
+
show,
|
208
|
+
hide,
|
209
|
+
cancel
|
210
|
+
});
|
211
|
+
</script>
|