@xilonglab/vue-main 1.3.21 → 1.3.25
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/package.json
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineOptions({ name: "XlBoxImage" })
|
|
3
|
+
|
|
4
|
+
import { computed } from 'vue'
|
|
5
|
+
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
value: {
|
|
8
|
+
type: Object,
|
|
9
|
+
default: () => ({})
|
|
10
|
+
},
|
|
11
|
+
width: {
|
|
12
|
+
type: Number,
|
|
13
|
+
default: 100
|
|
14
|
+
},
|
|
15
|
+
height: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 100
|
|
18
|
+
},
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
const imageSrc = computed(() => {
|
|
22
|
+
if (props.value && props.value.uri) {
|
|
23
|
+
return `/storage/${props.value.uri}`
|
|
24
|
+
}
|
|
25
|
+
return ''
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
const imageStyle = computed(() => {
|
|
29
|
+
const style = {}
|
|
30
|
+
if (props.value && props.value.width) {
|
|
31
|
+
style.width = `${props.value.width}px`
|
|
32
|
+
}
|
|
33
|
+
if (props.value && props.value.height) {
|
|
34
|
+
style.height = `${props.value.height}px`
|
|
35
|
+
}
|
|
36
|
+
style.maxWidth = `${props.width}px`
|
|
37
|
+
style.maxHeight = `${props.height}px`
|
|
38
|
+
return style
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<img v-if="imageSrc"
|
|
45
|
+
class="xl-box-image"
|
|
46
|
+
:src="imageSrc"
|
|
47
|
+
:style="imageStyle" />
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<style lang="less" scoped>
|
|
51
|
+
.xl-box-image {
|
|
52
|
+
object-fit: contain;
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
|
|
@@ -15,12 +15,8 @@ const props = defineProps({
|
|
|
15
15
|
|
|
16
16
|
<template>
|
|
17
17
|
<template v-for="col in columns" :key="col.prop">
|
|
18
|
-
<slot
|
|
19
|
-
v-if="col.slot"
|
|
20
|
-
:name="col.slot"
|
|
21
|
-
/>
|
|
22
18
|
<xl-form-col
|
|
23
|
-
v-
|
|
19
|
+
v-if="col.form"
|
|
24
20
|
:span="col.form.span"
|
|
25
21
|
:l="col.label"
|
|
26
22
|
:p="col.prop"
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
defineOptions({ name: "XlBoxImage" })
|
|
3
|
-
|
|
4
|
-
import { computed } from 'vue'
|
|
5
|
-
|
|
6
|
-
const props = defineProps({
|
|
7
|
-
value: {
|
|
8
|
-
type: Object,
|
|
9
|
-
default: () => ({})
|
|
10
|
-
},
|
|
11
|
-
boxwidth: {
|
|
12
|
-
type: Number,
|
|
13
|
-
default: 100
|
|
14
|
-
},
|
|
15
|
-
boxheight: {
|
|
16
|
-
type: Number,
|
|
17
|
-
default: 100
|
|
18
|
-
},
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
const imageSrc = computed(() => {
|
|
22
|
-
if (props.value && props.value.uri) {
|
|
23
|
-
return `/storage/${props.value.uri}`
|
|
24
|
-
}
|
|
25
|
-
return ''
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<template>
|
|
31
|
-
<div class="xl-box-image"
|
|
32
|
-
:style="{
|
|
33
|
-
width: `${boxwidth}px`,
|
|
34
|
-
height: `${boxheight}px`
|
|
35
|
-
}">
|
|
36
|
-
<img v-if="imageSrc"
|
|
37
|
-
class="image"
|
|
38
|
-
:src="imageSrc" />
|
|
39
|
-
</div>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<style lang="less" scoped>
|
|
43
|
-
.xl-box-image {
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
border: 1px solid var(--el-border-color);
|
|
49
|
-
border-radius: 4px;
|
|
50
|
-
|
|
51
|
-
.image {
|
|
52
|
-
max-width: 100%;
|
|
53
|
-
max-height: 100%;
|
|
54
|
-
display: block;
|
|
55
|
-
object-fit: contain;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
</style>
|
|
59
|
-
|