@thinkpixellab-public/px-vue 4.0.13 → 4.0.15

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.
@@ -6,18 +6,21 @@
6
6
 
7
7
  -->
8
8
  <template>
9
- <qrcode-vue
10
- :class="bem()"
11
- v-if="content"
12
- :value="content"
13
- :size="size"
14
- role="img"
15
- :aria-label="label || content"
16
- ></qrcode-vue>
9
+ <div :class="bem()">
10
+ <qrcode-vue
11
+ v-if="content"
12
+ :value="content"
13
+ role="img"
14
+ :size="size"
15
+ :margin="padding"
16
+ :aria-label="label || content"
17
+ ></qrcode-vue>
18
+ </div>
17
19
  </template>
18
20
 
19
21
  <script>
20
22
  import QrcodeVue from 'qrcode.vue';
23
+ // test
21
24
 
22
25
  export default {
23
26
  name: 'px-qr-code',
@@ -25,7 +28,23 @@ export default {
25
28
  props: {
26
29
  content: { type: String, default: 'Hello' },
27
30
  label: { type: String },
28
- size: { type: Number, default: 400 },
31
+ padding: { type: Number, default: 0 },
32
+ },
33
+ data() {
34
+ return { size: null };
35
+ },
36
+ mounted() {
37
+ this.size = Math.min(this.$el.clientWidth, this.$el.clientHeight);
38
+
39
+ this.onSizeChange = () => {
40
+ this.size = Math.min(this.$el.clientWidth, this.$el.clientHeight);
41
+ };
42
+
43
+ this.resizeObserver = new ResizeObserver(this.onSizeChange);
44
+ this.resizeObserver.observe(this.$el);
45
+ },
46
+ beforeUnmount() {
47
+ this.resizeObserver.disconnect();
29
48
  },
30
49
  };
31
50
  </script>
@@ -33,13 +52,5 @@ export default {
33
52
  <style lang="scss">
34
53
  .px-qr-code {
35
54
  aspect-ratio: 1;
36
- width: 256px;
37
- canvas {
38
- position: absolute;
39
- top: 0;
40
- left: 0;
41
- width: 100% !important;
42
- height: 100% !important;
43
- }
44
55
  }
45
56
  </style>
@@ -40,7 +40,7 @@
40
40
  </template>
41
41
 
42
42
  <script>
43
- import { getClientRect } from '@thinkpixellab-public/px-vue/utils/utils.js';
43
+ import { getClientRect } from '../utils/utils.js';
44
44
 
45
45
  export default {
46
46
  name: 'px-transition-item',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "4.0.13",
3
+ "version": "4.0.15",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": "Pixel Lab",
6
6
  "license": "MIT",