wl-design-mobile 0.0.7 → 0.0.9

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.
@@ -1,9 +1,8 @@
1
1
  <template>
2
- <div class="btn-sel">
2
+ <div class="btn-sel" ref="btnSel">
3
3
  <lambo-btn :type="type" :text="text" :size="size" :position="position" :disabled="disabled" :icon="icon"
4
- :loading="loading"
5
- :class="dynamicClass" @click="onClick"></lambo-btn>
6
- <ul v-show="show" class="extend-ul">
4
+ :loading="loading" :class="dynamicClass" @click="onClick"></lambo-btn>
5
+ <ul v-show="show" class="extend-ul" @click="toggleClick">
7
6
  <slot></slot>
8
7
  </ul>
9
8
  </div>
@@ -53,6 +52,21 @@ export default {
53
52
  onClick() {
54
53
  this.show = !this.show;
55
54
  },
55
+ handleClickOutside(event) {
56
+ const btnSel = this.$refs.btnSel;
57
+ if (btnSel && !btnSel.contains(event.target)) {
58
+ this.show = false;
59
+ }
60
+ },
61
+ toggleClick() {
62
+ this.show = !this.show;
63
+ }
64
+ },
65
+ mounted() {
66
+ document.addEventListener('click', this.handleClickOutside);
67
+ },
68
+ beforeDestroy() {
69
+ document.removeEventListener('click', this.handleClickOutside);
56
70
  },
57
71
  computed: {
58
72
  dynamicClass() {
@@ -101,6 +115,7 @@ export default {
101
115
  }
102
116
 
103
117
  .extend-ul {
118
+ position: absolute;
104
119
  z-index: 999;
105
120
  }
106
121
  </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "wl-design-mobile",
3
- "version": "0.0.7",
4
- "description": "",
3
+ "version": "0.0.9",
4
+ "description": "0.0.9",
5
5
  "main": "index.js",
6
6
  "author": "finch",
7
7
  "license": "ISC",
@@ -69,7 +69,7 @@ export default {
69
69
  align-items: center;
70
70
  align-content: center;
71
71
  background-color: var(--scl-white-1);
72
- padding: 10px 14px;
72
+ padding: 0px 14px;
73
73
  }
74
74
 
75
75
  .title1-border-line {