|
@@ -1,9 +1,9 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 组件:背景图显示盒子 -->
|
|
<!-- 组件:背景图显示盒子 -->
|
|
|
<FlexView
|
|
<FlexView
|
|
|
|
|
+ v-bind="$props"
|
|
|
center
|
|
center
|
|
|
:flexShrink="0"
|
|
:flexShrink="0"
|
|
|
- v-bind="$props"
|
|
|
|
|
:innerStyle="style"
|
|
:innerStyle="style"
|
|
|
>
|
|
>
|
|
|
<slot />
|
|
<slot />
|
|
@@ -38,64 +38,39 @@ export default {}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
|
-import FlexView from '@/components/layout/FlexView.vue';
|
|
|
|
|
|
|
+import FlexView, { type FlexProps } from '@/components/layout/FlexView.vue';
|
|
|
import { useTheme, type ViewStyle } from '@/components/theme/ThemeDefine';
|
|
import { useTheme, type ViewStyle } from '@/components/theme/ThemeDefine';
|
|
|
import { solveUrl } from '@/components/theme/ThemeTools';
|
|
import { solveUrl } from '@/components/theme/ThemeTools';
|
|
|
import { computed, type PropType } from 'vue';
|
|
import { computed, type PropType } from 'vue';
|
|
|
|
|
|
|
|
-defineOptions({
|
|
|
|
|
- options: {
|
|
|
|
|
- virtualHost: true,
|
|
|
|
|
- styleIsolation: "shared",
|
|
|
|
|
- },
|
|
|
|
|
-});
|
|
|
|
|
-
|
|
|
|
|
-/**
|
|
|
|
|
- * 内容积木组件:背景盒子,
|
|
|
|
|
- */
|
|
|
|
|
-const props = defineProps({
|
|
|
|
|
|
|
+export interface BackgroundBoxProps extends FlexProps {
|
|
|
/**
|
|
/**
|
|
|
* 背景颜色(1)。
|
|
* 背景颜色(1)。
|
|
|
*
|
|
*
|
|
|
- * 格式:字符串格式或主题中定义的 background 颜色预设。
|
|
|
|
|
|
|
+ * 格式:字符串格式或主题中定义的颜色预设。
|
|
|
*/
|
|
*/
|
|
|
- color1: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ color1?: string;
|
|
|
/**
|
|
/**
|
|
|
* 背景颜色(2)。
|
|
* 背景颜色(2)。
|
|
|
*
|
|
*
|
|
|
- * 格式:字符串格式或主题中定义的 background 颜色预设。
|
|
|
|
|
|
|
+ * 格式:字符串格式或主题中定义的颜色预设。
|
|
|
*/
|
|
*/
|
|
|
- color2: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ color2?: string;
|
|
|
/**
|
|
/**
|
|
|
* 圆角。
|
|
* 圆角。
|
|
|
*/
|
|
*/
|
|
|
- radius: {
|
|
|
|
|
- type: [String, Number],
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ radius?: string | number;
|
|
|
/**
|
|
/**
|
|
|
* 背景渐变角度。
|
|
* 背景渐变角度。
|
|
|
* 只有 color1 和 color2 都定义时有效。
|
|
* 只有 color1 和 color2 都定义时有效。
|
|
|
*
|
|
*
|
|
|
* 格式:角度(0-360)。
|
|
* 格式:角度(0-360)。
|
|
|
*/
|
|
*/
|
|
|
- gradientAngle: {
|
|
|
|
|
- type: Number,
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ gradientAngle?: number;
|
|
|
/**
|
|
/**
|
|
|
* 背景图片。
|
|
* 背景图片。
|
|
|
*/
|
|
*/
|
|
|
- backgroundImage: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ backgroundImage?: string;
|
|
|
/**
|
|
/**
|
|
|
* 背景填充方式。
|
|
* 背景填充方式。
|
|
|
*
|
|
*
|
|
@@ -104,50 +79,60 @@ const props = defineProps({
|
|
|
* - fillH:纵向填充,宽度变化。
|
|
* - fillH:纵向填充,宽度变化。
|
|
|
* - none:不填充。
|
|
* - none:不填充。
|
|
|
*/
|
|
*/
|
|
|
- backgroundFillType: {
|
|
|
|
|
- type: String as PropType<'none'|'fillH'|'fillW'>,
|
|
|
|
|
- default: "fillW"
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ backgroundFillType?: 'none'|'fillH'|'fillW';
|
|
|
/**
|
|
/**
|
|
|
* 背景填充大小。
|
|
* 背景填充大小。
|
|
|
*/
|
|
*/
|
|
|
- backgroundSize: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: "100%"
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ backgroundSize?: string;
|
|
|
/**
|
|
/**
|
|
|
* 背景填充位置。
|
|
* 背景填充位置。
|
|
|
*/
|
|
*/
|
|
|
- backgroundPosition: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ backgroundPosition?: string;
|
|
|
/**
|
|
/**
|
|
|
* 背景图片九宫格裁剪大小。
|
|
* 背景图片九宫格裁剪大小。
|
|
|
*
|
|
*
|
|
|
* 格式:
|
|
* 格式:
|
|
|
* - 数组:[ top, right, bottom, left ]
|
|
* - 数组:[ top, right, bottom, left ]
|
|
|
*/
|
|
*/
|
|
|
- backgroundCutBorder: {
|
|
|
|
|
- type: Object as PropType<Array<number|string>>,
|
|
|
|
|
- default: undefined
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ backgroundCutBorder?: Array<number|string>;
|
|
|
/**
|
|
/**
|
|
|
* 背景图片九宫格渲染大小。
|
|
* 背景图片九宫格渲染大小。
|
|
|
*
|
|
*
|
|
|
* 格式:
|
|
* 格式:
|
|
|
* - 数组:[ top, right, bottom, left ]
|
|
* - 数组:[ top, right, bottom, left ]
|
|
|
*/
|
|
*/
|
|
|
- backgroundCutBorderSize: {
|
|
|
|
|
- type: Object as PropType<Array<number|string>>,
|
|
|
|
|
- default: () => ([ 'auto' ])
|
|
|
|
|
|
|
+ backgroundCutBorderSize?: Array<number|string>;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+defineOptions({
|
|
|
|
|
+ options: {
|
|
|
|
|
+ virtualHost: true,
|
|
|
|
|
+ styleIsolation: "shared",
|
|
|
},
|
|
},
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+/**
|
|
|
|
|
+ * 内容积木组件:背景盒子,
|
|
|
|
|
+ */
|
|
|
|
|
+const props = withDefaults(defineProps<BackgroundBoxProps>(), {
|
|
|
|
|
+ color1: undefined,
|
|
|
|
|
+ color2: undefined,
|
|
|
|
|
+ radius: undefined,
|
|
|
|
|
+ gradientAngle: undefined,
|
|
|
|
|
+ backgroundImage: undefined,
|
|
|
|
|
+ backgroundFillType: "fillW",
|
|
|
|
|
+ backgroundSize: "100%",
|
|
|
|
|
+ backgroundPosition: undefined,
|
|
|
|
|
+ backgroundCutBorder: undefined,
|
|
|
|
|
+ backgroundCutBorderSize: () => ([ 'auto' ]),
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const theme = useTheme();
|
|
const theme = useTheme();
|
|
|
|
|
|
|
|
const style = computed(() => {
|
|
const style = computed(() => {
|
|
|
- const o : ViewStyle = {}
|
|
|
|
|
|
|
+ const o : ViewStyle = {
|
|
|
|
|
+ ...props.innerStyle,
|
|
|
|
|
+ }
|
|
|
if (props.radius) {
|
|
if (props.radius) {
|
|
|
o.borderRadius = theme.resolveThemeSize(props.radius);
|
|
o.borderRadius = theme.resolveThemeSize(props.radius);
|
|
|
}
|
|
}
|