grantthomas-nuxt 1.0.5 → 1.0.6
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/dist/module.json
CHANGED
|
@@ -9,12 +9,15 @@ const props = defineProps({
|
|
|
9
9
|
},
|
|
10
10
|
aspectRatio: {
|
|
11
11
|
type: String,
|
|
12
|
-
default:
|
|
12
|
+
default: null
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
15
|
const emit = defineEmits(["crop", "cancel"]);
|
|
16
16
|
const cropper = ref(null);
|
|
17
17
|
const parsedAspectRatio = computed(() => {
|
|
18
|
+
if (!props.aspectRatio) {
|
|
19
|
+
return void 0;
|
|
20
|
+
}
|
|
18
21
|
const parts = props.aspectRatio.split(":");
|
|
19
22
|
if (parts.length === 2) {
|
|
20
23
|
const width = parseFloat(parts[0]);
|
|
@@ -23,7 +26,14 @@ const parsedAspectRatio = computed(() => {
|
|
|
23
26
|
return width / height;
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
|
-
return
|
|
29
|
+
return void 0;
|
|
30
|
+
});
|
|
31
|
+
const stencilProps = computed(() => {
|
|
32
|
+
const props2 = {};
|
|
33
|
+
if (parsedAspectRatio.value !== void 0) {
|
|
34
|
+
props2.aspectRatio = parsedAspectRatio.value;
|
|
35
|
+
}
|
|
36
|
+
return props2;
|
|
27
37
|
});
|
|
28
38
|
const crop = () => {
|
|
29
39
|
if (cropper.value) {
|
|
@@ -51,9 +61,7 @@ const cancel = () => {
|
|
|
51
61
|
<Cropper
|
|
52
62
|
ref="cropper"
|
|
53
63
|
:src="imageUrl"
|
|
54
|
-
:stencil-props="
|
|
55
|
-
aspectRatio: parsedAspectRatio
|
|
56
|
-
}"
|
|
64
|
+
:stencil-props="stencilProps"
|
|
57
65
|
class="cropper"
|
|
58
66
|
/>
|
|
59
67
|
</div>
|