cbvirtua 1.0.102 → 1.0.104

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.
Files changed (51) hide show
  1. package/better-scroll-dev.zip +0 -0
  2. package/package.json +1 -1
  3. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/.hbuilderx/launch.json +11 -0
  4. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/App.vue +17 -0
  5. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/README.md +13 -0
  6. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/code.js +408 -0
  7. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/css/icon.css +342 -0
  8. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/css/style.scss +119 -0
  9. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/search/index.vue +66 -0
  10. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/components/xiaolu-tree/tree.vue +70 -0
  11. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/main.js +11 -0
  12. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/manifest.json +78 -0
  13. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/chooseUser/chooseUser.vue +69 -0
  14. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/chooseUser/data.js +96 -0
  15. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages/index/index.vue +122 -0
  16. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/pages.json +25 -0
  17. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/changelog.md +80 -0
  18. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/en.json +7 -0
  19. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/index.js +8 -0
  20. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hans.json +7 -0
  21. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/i18n/zh-Hant.json +7 -0
  22. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/keypress.js +45 -0
  23. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/popup.js +26 -0
  24. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/uni-popup.uvue +90 -0
  25. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +496 -0
  26. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-dialog/keypress.js +45 -0
  27. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-dialog/uni-popup-dialog.vue +313 -0
  28. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-message/uni-popup-message.vue +143 -0
  29. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/components/uni-popup-share/uni-popup-share.vue +187 -0
  30. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/package.json +87 -0
  31. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-popup/readme.md +17 -0
  32. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/changelog.md +8 -0
  33. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/index.scss +1 -0
  34. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/package.json +82 -0
  35. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/readme.md +4 -0
  36. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/index.scss +7 -0
  37. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_border.scss +3 -0
  38. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_color.scss +66 -0
  39. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_radius.scss +55 -0
  40. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_space.scss +56 -0
  41. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_styles.scss +167 -0
  42. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_text.scss +24 -0
  43. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/setting/_variables.scss +146 -0
  44. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/styles/tools/functions.scss +19 -0
  45. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/theme.scss +31 -0
  46. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-scss/variables.scss +62 -0
  47. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/changelog.md +22 -0
  48. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/components/uni-transition/createAnimation.js +131 -0
  49. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/components/uni-transition/uni-transition.vue +286 -0
  50. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/package.json +84 -0
  51. package/xiaolu-tree-plugin-main/xiaolu-tree-plugin-main/uni_modules/uni-transition/readme.md +11 -0
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <view>
3
+ <xiaolu-tree :checkList="checkList" v-if="tree.length>0" :props="prop" @sendValue="confirm" :isCheck="true" :treeNone="tree"></xiaolu-tree>
4
+
5
+ </view>
6
+ </template>
7
+
8
+ <script>
9
+ import XiaoluTree from '@/components/xiaolu-tree/tree.vue';
10
+ import {treeNode} from './data.js'
11
+
12
+ export default {
13
+ components: {
14
+ XiaoluTree
15
+ },
16
+ data() {
17
+ return {
18
+ tree: [],
19
+ checkList: [],
20
+ backList: this.checkList,
21
+ prop:{},
22
+ max: 5,
23
+ }
24
+ },
25
+ onLoad(option) {
26
+ this.prop = JSON.parse(option.prop)
27
+ this.checkList = uni.getStorageSync('checkList');
28
+ this.tree = treeNode;//树形数据赋值
29
+ },
30
+ methods: {
31
+ //获取选中的值
32
+ confirm(val,back) {
33
+ if(back){
34
+ this.backConfirm(val)
35
+ return
36
+ }
37
+ this.backList = val;
38
+ },
39
+
40
+ // 返回上一页传参
41
+ backConfirm(val) {
42
+ uni.$emit('selectSuccess',{list:val})
43
+ uni.navigateBack();
44
+ }
45
+ }
46
+ }
47
+ </script>
48
+
49
+ <style lang="scss" scoped>
50
+ .box_sizing {
51
+ -webkit-box-sizing: border-box;
52
+ -moz-box-sizing: border-box;
53
+ box-sizing: border-box;
54
+ }
55
+
56
+ .btn {
57
+ position: fixed;
58
+ bottom: 0;
59
+ padding: 10px;
60
+ background-color: #fff;
61
+ width: 100%;
62
+
63
+ .sureBtn {
64
+ background-color: #0095F2;
65
+ color: #fff;
66
+ }
67
+ }
68
+
69
+ </style>
@@ -0,0 +1,96 @@
1
+ const treeNode = [{
2
+ name: '一级',
3
+ id: '1',
4
+ user: false,
5
+ children: [{
6
+ name: '二级-1',
7
+ id: '2-1',
8
+ user: false,
9
+ children: [{
10
+ name: '三级-1',
11
+ id: '3-1',
12
+ user: false,
13
+ children: [{
14
+ name: '四级-1',
15
+ id: '4-1',
16
+ user: false,
17
+ children: [{
18
+ name: '五级-1',
19
+ id: '5-1',
20
+ user: false,
21
+ children: [{
22
+ name: '六级-1',
23
+ id: '6-1',
24
+ user: true,
25
+ children: [
26
+
27
+ ]
28
+ },
29
+ ...makeTreeNode(5)
30
+ ]
31
+ },
32
+ ...makeTreeNode(4)
33
+ ]
34
+ },
35
+ ...makeTreeNode(3)
36
+ ]
37
+ },
38
+ ...makeTreeNode(2)
39
+ ],
40
+ },
41
+ ...makeTreeNode(1)
42
+ ]
43
+ },
44
+ {
45
+ name: '一级-2',
46
+ id: '1-1-1',
47
+ user: false,
48
+ children: [{
49
+ name: '1-二级-1',
50
+ id: '1-6-1665',
51
+ user: false,
52
+ children: [{
53
+ name: '1-三级-1',
54
+ id: '1-5-1',
55
+ user: false,
56
+ children: [{
57
+ name: '1-四级-1',
58
+ id: '1-6-166',
59
+ user: true,
60
+ children: [
61
+ ...makeTreeNode('1-四级-1')
62
+ ]
63
+ },
64
+ ...makeTreeNode('1-三级-1')
65
+ ]
66
+ },
67
+ ...makeTreeNode('2-1')
68
+ ]
69
+ },
70
+ ...makeTreeNode('1-1')
71
+ ]
72
+ },
73
+ ]
74
+
75
+ function makeTreeNode(leval) {
76
+ let treeNoneList = []
77
+ for (let k = 0; k < 100; k++) {
78
+ treeNoneList.push({
79
+ name: `${leval}级-${k}`,
80
+ id: guid(),
81
+ user: true
82
+ })
83
+ }
84
+ return treeNoneList
85
+ }
86
+
87
+ function guid() {
88
+ function S4() {
89
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
90
+ }
91
+ return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
92
+ }
93
+
94
+ export {
95
+ treeNode
96
+ };
@@ -0,0 +1,122 @@
1
+ <template>
2
+ <view>
3
+
4
+ <uniPopup borderRadius="10px 10px 0 0" background-color="#fff" ref="popup" type="bottom">
5
+ <view>
6
+ <xiaolu-tree scrollHeight="80vh" :checkList="checkList" v-if="tree.length>0" :props="bprop"
7
+ @sendValue="confirm" :isCheck="true" :treeNone="tree"></xiaolu-tree>
8
+ </view>
9
+ </uniPopup>
10
+ <button class="btn" @click="showPop" type="primary">底部弹出选择</button>
11
+ <button class="btn" @click="toChoose(aprop)" type="primary">多选模式(选择任意一项)</button>
12
+ <button class="btn" @click="toChoose(bprop)" type="primary">多选模式(关联下级)</button>
13
+ <button class="btn" @click="toChoose(cprop)" type="primary">单选模式(任意一项)</button>
14
+ <button class="btn" @click="toChoose(dprop)" type="primary">单选(只选user)</button>
15
+
16
+ <button class="btn" @click="clear()" type="default">清空选择</button>
17
+ <view class="children">
18
+ <view v-for="(item,index) in selectListItem" style="font-size: 24rpx;"
19
+ :key="index">
20
+ <view style="color: red;">选中的值:{{item.name}};&nbsp;</view>
21
+ 路径:
22
+ <view v-for="(row,k) in item.path" style="display: inline-block;font-size: 24rpx;" :key="k">
23
+ {{row.name}}
24
+ </view>
25
+ </view>
26
+ </view>
27
+ </view>
28
+ </template>
29
+
30
+
31
+ <script>
32
+ /*
33
+ * 已兼容h5和小程序端,其它端没测试过,估计问题不大,只需要改一下传值的方式
34
+ * 如有问题可以加qq:122720267
35
+ * 使用该插件的朋友请给个好评,或者到git start一下
36
+ * git地址:https://github.com/LSZ579/xiaolu-tree-plugin.git
37
+ * 插件市场地址: https://ext.dcloud.net.cn/plugin?id=2423
38
+ *
39
+ */
40
+ import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
41
+ import XiaoluTree from '@/components/xiaolu-tree/tree.vue';
42
+ import {
43
+ treeNode
44
+ } from '../chooseUser/data.js'
45
+ export default {
46
+ components: {
47
+ uniPopup,
48
+ XiaoluTree
49
+ },
50
+ data() {
51
+ return {
52
+ selectListItem: [],
53
+ aprop: {
54
+ label: 'name',
55
+ children: 'children',
56
+ multiple: true,
57
+ hasPath: true
58
+ },
59
+ bprop: {
60
+ label: 'name',
61
+ children: 'children',
62
+ multiple: true,
63
+ checkStrictly: true,
64
+ hasPath: true
65
+ },
66
+ cprop: { //单选模式(任意一项)
67
+ label: 'name',
68
+ children: 'children',
69
+ multiple: false,
70
+ nodes: false,
71
+ hasPath: true
72
+ },
73
+ dprop: { //单选模式选user
74
+ label: 'name',
75
+ children: 'children',
76
+ multiple: false,
77
+ nodes: true,
78
+ hasPath: true
79
+ },
80
+ tree: treeNode,
81
+ checkList:[]
82
+ }
83
+ },
84
+ created() {
85
+ uni.$on('selectSuccess', (data) => {
86
+ this.$set(this, 'selectListItem', [...data.list])
87
+ })
88
+ },
89
+ methods: {
90
+ showPop() {
91
+ this.checkList = JSON.parse(JSON.stringify(this.selectListItem))
92
+ this.$refs.popup.open('bottom')
93
+ },
94
+ confirm(val) {
95
+ this.$set(this, 'selectListItem', [...val])
96
+ this.$refs.popup?.close()
97
+ },
98
+ toChoose(prop) {
99
+ wx.setStorageSync('checkList',this.selectListItem)
100
+ uni.navigateTo({
101
+ url: `../chooseUser/chooseUser?prop=${JSON.stringify(prop)}`
102
+ })
103
+ },
104
+ clear() {
105
+ this.selectListItem = [];
106
+ }
107
+ }
108
+ }
109
+ </script>
110
+
111
+ <style scoped lang="scss">
112
+ .children {
113
+ color: #BBB2B2;
114
+ }
115
+
116
+ .color {
117
+ color: #bbb2b2;
118
+ }
119
+ .btn {
120
+ margin: 10px auto;
121
+ }
122
+ </style>
@@ -0,0 +1,25 @@
1
+ {
2
+ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
3
+ {
4
+ "path" : "pages/index/index",
5
+ "style" :
6
+ {
7
+ "navigationBarTitleText": "无限级选择组件-动态加载",
8
+ "enablePullDownRefresh": false
9
+ }
10
+
11
+ },
12
+
13
+ {
14
+ "path" : "pages/chooseUser/chooseUser",
15
+ "style" : {}
16
+ }
17
+
18
+ ],
19
+ "globalStyle": {
20
+ "navigationBarTextStyle": "black",
21
+ "navigationBarTitleText": "uni-app",
22
+ "navigationBarBackgroundColor": "#F8F8F8",
23
+ "backgroundColor": "#F8F8F8"
24
+ }
25
+ }
@@ -0,0 +1,80 @@
1
+ ## 1.8.9(2024-03-20)
2
+ - 修复 uni-popup-dialog 数据输入时修正为双向绑定
3
+ ## 1.8.8(2024-02-20)
4
+ - 修复 uni-popup 在微信小程序下出现文字向上闪动的bug
5
+ ## 1.8.7(2024-02-02)
6
+ - 新增 uni-popup-dialog 新增属性focus:input模式下,是否自动自动聚焦
7
+ ## 1.8.6(2024-01-30)
8
+ - 新增 uni-popup-dialog 新增属性maxLength:限制输入框字数
9
+ ## 1.8.5(2024-01-26)
10
+ - 新增 uni-popup-dialog 新增属性showClose:控制关闭按钮的显示
11
+ ## 1.8.4(2023-11-15)
12
+ - 新增 uni-popup 支持uni-app-x 注意暂时仅支持 `maskClick` `@open` `@close`
13
+ ## 1.8.3(2023-04-17)
14
+ - 修复 uni-popup 重复打开时的 bug
15
+ ## 1.8.2(2023-02-02)
16
+ - uni-popup-dialog 组件新增 inputType 属性
17
+ ## 1.8.1(2022-12-01)
18
+ - 修复 nvue 下 v-show 报错
19
+ ## 1.8.0(2022-11-29)
20
+ - 优化 主题样式
21
+ ## 1.7.9(2022-04-02)
22
+ - 修复 弹出层内部无法滚动的bug
23
+ ## 1.7.8(2022-03-28)
24
+ - 修复 小程序中高度错误的bug
25
+ ## 1.7.7(2022-03-17)
26
+ - 修复 快速调用open出现问题的Bug
27
+ ## 1.7.6(2022-02-14)
28
+ - 修复 safeArea 属性不能设置为false的bug
29
+ ## 1.7.5(2022-01-19)
30
+ - 修复 isMaskClick 失效的bug
31
+ ## 1.7.4(2022-01-19)
32
+ - 新增 cancelText \ confirmText 属性 ,可自定义文本
33
+ - 新增 maskBackgroundColor 属性 ,可以修改蒙版颜色
34
+ - 优化 maskClick属性 更新为 isMaskClick ,解决微信小程序警告的问题
35
+ ## 1.7.3(2022-01-13)
36
+ - 修复 设置 safeArea 属性不生效的bug
37
+ ## 1.7.2(2021-11-26)
38
+ - 优化 组件示例
39
+ ## 1.7.1(2021-11-26)
40
+ - 修复 vuedoc 文字错误
41
+ ## 1.7.0(2021-11-19)
42
+ - 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
43
+ - 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-popup](https://uniapp.dcloud.io/component/uniui/uni-popup)
44
+ ## 1.6.2(2021-08-24)
45
+ - 新增 支持国际化
46
+ ## 1.6.1(2021-07-30)
47
+ - 优化 vue3下事件警告的问题
48
+ ## 1.6.0(2021-07-13)
49
+ - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
50
+ ## 1.5.0(2021-06-23)
51
+ - 新增 mask-click 遮罩层点击事件
52
+ ## 1.4.5(2021-06-22)
53
+ - 修复 nvue 平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug
54
+ ## 1.4.4(2021-06-18)
55
+ - 修复 H5平台中间弹出后,点击内容,再点击遮罩无法关闭的Bug
56
+ ## 1.4.3(2021-06-08)
57
+ - 修复 错误的 watch 字段
58
+ - 修复 safeArea 属性不生效的问题
59
+ - 修复 点击内容,再点击遮罩无法关闭的Bug
60
+ ## 1.4.2(2021-05-12)
61
+ - 新增 组件示例地址
62
+ ## 1.4.1(2021-04-29)
63
+ - 修复 组件内放置 input 、textarea 组件,无法聚焦的问题
64
+ ## 1.4.0 (2021-04-29)
65
+ - 新增 type 属性的 left\right 值,支持左右弹出
66
+ - 新增 open(String:type) 方法参数 ,可以省略 type 属性 ,直接传入类型打开指定弹窗
67
+ - 新增 backgroundColor 属性,可定义主窗口背景色,默认不显示背景色
68
+ - 新增 safeArea 属性,是否适配底部安全区
69
+ - 修复 App\h5\微信小程序底部安全区占位不对的Bug
70
+ - 修复 App 端弹出等待的Bug
71
+ - 优化 提升低配设备性能,优化动画卡顿问题
72
+ - 优化 更简单的组件自定义方式
73
+ ## 1.2.9(2021-02-05)
74
+ - 优化 组件引用关系,通过uni_modules引用组件
75
+ ## 1.2.8(2021-02-05)
76
+ - 调整为uni_modules目录规范
77
+ ## 1.2.7(2021-02-05)
78
+ - 调整为uni_modules目录规范
79
+ - 新增 支持 PC 端
80
+ - 新增 uni-popup-message 、uni-popup-dialog扩展组件支持 PC 端
@@ -0,0 +1,7 @@
1
+ {
2
+ "uni-popup.cancel": "cancel",
3
+ "uni-popup.ok": "ok",
4
+ "uni-popup.placeholder": "pleace enter",
5
+ "uni-popup.title": "Hint",
6
+ "uni-popup.shareTitle": "Share to"
7
+ }
@@ -0,0 +1,8 @@
1
+ import en from './en.json'
2
+ import zhHans from './zh-Hans.json'
3
+ import zhHant from './zh-Hant.json'
4
+ export default {
5
+ en,
6
+ 'zh-Hans': zhHans,
7
+ 'zh-Hant': zhHant
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "uni-popup.cancel": "取消",
3
+ "uni-popup.ok": "确定",
4
+ "uni-popup.placeholder": "请输入",
5
+ "uni-popup.title": "提示",
6
+ "uni-popup.shareTitle": "分享到"
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "uni-popup.cancel": "取消",
3
+ "uni-popup.ok": "確定",
4
+ "uni-popup.placeholder": "請輸入",
5
+ "uni-popup.title": "提示",
6
+ "uni-popup.shareTitle": "分享到"
7
+ }
@@ -0,0 +1,45 @@
1
+ // #ifdef H5
2
+ export default {
3
+ name: 'Keypress',
4
+ props: {
5
+ disable: {
6
+ type: Boolean,
7
+ default: false
8
+ }
9
+ },
10
+ mounted () {
11
+ const keyNames = {
12
+ esc: ['Esc', 'Escape'],
13
+ tab: 'Tab',
14
+ enter: 'Enter',
15
+ space: [' ', 'Spacebar'],
16
+ up: ['Up', 'ArrowUp'],
17
+ left: ['Left', 'ArrowLeft'],
18
+ right: ['Right', 'ArrowRight'],
19
+ down: ['Down', 'ArrowDown'],
20
+ delete: ['Backspace', 'Delete', 'Del']
21
+ }
22
+ const listener = ($event) => {
23
+ if (this.disable) {
24
+ return
25
+ }
26
+ const keyName = Object.keys(keyNames).find(key => {
27
+ const keyName = $event.key
28
+ const value = keyNames[key]
29
+ return value === keyName || (Array.isArray(value) && value.includes(keyName))
30
+ })
31
+ if (keyName) {
32
+ // 避免和其他按键事件冲突
33
+ setTimeout(() => {
34
+ this.$emit(keyName, {})
35
+ }, 0)
36
+ }
37
+ }
38
+ document.addEventListener('keyup', listener)
39
+ // this.$once('hook:beforeDestroy', () => {
40
+ // document.removeEventListener('keyup', listener)
41
+ // })
42
+ },
43
+ render: () => {}
44
+ }
45
+ // #endif
@@ -0,0 +1,26 @@
1
+
2
+ export default {
3
+ data() {
4
+ return {
5
+
6
+ }
7
+ },
8
+ created(){
9
+ this.popup = this.getParent()
10
+ },
11
+ methods:{
12
+ /**
13
+ * 获取父元素实例
14
+ */
15
+ getParent(name = 'uniPopup') {
16
+ let parent = this.$parent;
17
+ let parentName = parent.$options.name;
18
+ while (parentName !== name) {
19
+ parent = parent.$parent;
20
+ if (!parent) return false
21
+ parentName = parent.$options.name;
22
+ }
23
+ return parent;
24
+ },
25
+ }
26
+ }
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <view class="popup-root" v-if="isOpen" v-show="isShow" @click="clickMask">
3
+ <view @click.stop>
4
+ <slot></slot>
5
+ </view>
6
+ </view>
7
+ </template>
8
+
9
+ <script>
10
+ type CloseCallBack = ()=> void;
11
+ let closeCallBack:CloseCallBack = () :void => {};
12
+ export default {
13
+ emits:["close","clickMask"],
14
+ data() {
15
+ return {
16
+ isShow:false,
17
+ isOpen:false
18
+ }
19
+ },
20
+ props: {
21
+ maskClick: {
22
+ type: Boolean,
23
+ default: true
24
+ },
25
+ },
26
+ watch: {
27
+ // 设置show = true 时,如果没有 open 需要设置为 open
28
+ isShow:{
29
+ handler(isShow) {
30
+ // console.log("isShow",isShow)
31
+ if(isShow && this.isOpen == false){
32
+ this.isOpen = true
33
+ }
34
+ },
35
+ immediate:true
36
+ },
37
+ // 设置isOpen = true 时,如果没有 isShow 需要设置为 isShow
38
+ isOpen:{
39
+ handler(isOpen) {
40
+ // console.log("isOpen",isOpen)
41
+ if(isOpen && this.isShow == false){
42
+ this.isShow = true
43
+ }
44
+ },
45
+ immediate:true
46
+ }
47
+ },
48
+ methods:{
49
+ open(){
50
+ // ...funs : CloseCallBack[]
51
+ // if(funs.length > 0){
52
+ // closeCallBack = funs[0]
53
+ // }
54
+ this.isOpen = true;
55
+ },
56
+ clickMask(){
57
+ if(this.maskClick == true){
58
+ this.$emit('clickMask')
59
+ this.close()
60
+ }
61
+ },
62
+ close(): void{
63
+ this.isOpen = false;
64
+ this.$emit('close')
65
+ closeCallBack()
66
+ },
67
+ hiden(){
68
+ this.isShow = false
69
+ },
70
+ show(){
71
+ this.isShow = true
72
+ }
73
+ }
74
+ }
75
+ </script>
76
+
77
+ <style>
78
+ .popup-root {
79
+ position: fixed;
80
+ top: 0;
81
+ left: 0;
82
+ width: 750rpx;
83
+ height: 100%;
84
+ flex: 1;
85
+ background-color: rgba(0, 0, 0, 0.3);
86
+ justify-content: center;
87
+ align-items: center;
88
+ z-index: 99;
89
+ }
90
+ </style>