|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
<template>
|
|
|
<Touchable
|
|
<Touchable
|
|
|
center
|
|
center
|
|
|
- :direction="(flexDirection as FlexDirection)"
|
|
|
|
|
|
|
+ :direction="flexDirection"
|
|
|
:innerStyle="style"
|
|
:innerStyle="style"
|
|
|
:touchable="touchable"
|
|
:touchable="touchable"
|
|
|
:radius="themeContext.resolveThemeSize(radius)"
|
|
:radius="themeContext.resolveThemeSize(radius)"
|
|
@@ -42,16 +42,13 @@
|
|
|
import type { IconProps } from '@/components/basic/Icon.vue';
|
|
import type { IconProps } from '@/components/basic/Icon.vue';
|
|
|
import { propGetThemeVar, useTheme } from '@/components/theme/ThemeDefine';
|
|
import { propGetThemeVar, useTheme } from '@/components/theme/ThemeDefine';
|
|
|
import { computed, inject } from 'vue';
|
|
import { computed, inject } from 'vue';
|
|
|
-import { type FlexDirection } from '../FlexView.vue';
|
|
|
|
|
-import Text from '@/components/basic/Text.vue';
|
|
|
|
|
-import Icon from '@/components/basic/Icon.vue';
|
|
|
|
|
|
|
+import type { FlexDirection } from '../FlexView.vue';
|
|
|
import Touchable from '@/components/feedback/Touchable.vue';
|
|
import Touchable from '@/components/feedback/Touchable.vue';
|
|
|
|
|
+import Icon from '@/components/basic/Icon.vue';
|
|
|
|
|
+import Text from '@/components/basic/Text.vue';
|
|
|
|
|
|
|
|
-/**
|
|
|
|
|
- * 网格块按钮。包含一个图标和文字。
|
|
|
|
|
- */
|
|
|
|
|
|
|
|
|
|
-export interface GridItemProps {
|
|
|
|
|
|
|
+export interface GridItemProps {
|
|
|
/**
|
|
/**
|
|
|
* 标题
|
|
* 标题
|
|
|
*/
|
|
*/
|
|
@@ -104,7 +101,7 @@ export interface GridItemProps {
|
|
|
/**
|
|
/**
|
|
|
* 如果填写字段,则在图片位置显示文字。同时icon不生效。
|
|
* 如果填写字段,则在图片位置显示文字。同时icon不生效。
|
|
|
*/
|
|
*/
|
|
|
- subTitle?: string|false;
|
|
|
|
|
|
|
+ subTitle?: string;
|
|
|
/**
|
|
/**
|
|
|
* 图片位置显示文字的颜色。
|
|
* 图片位置显示文字的颜色。
|
|
|
* @default Color.text
|
|
* @default Color.text
|
|
@@ -129,15 +126,6 @@ export interface GridItemProps {
|
|
|
radius?: number|string,
|
|
radius?: number|string,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-defineOptions({
|
|
|
|
|
- options: {
|
|
|
|
|
- virtualHost: true
|
|
|
|
|
- }
|
|
|
|
|
-})
|
|
|
|
|
-const emit = defineEmits([ 'click' ]);
|
|
|
|
|
-
|
|
|
|
|
-const themeContext = useTheme();
|
|
|
|
|
-
|
|
|
|
|
const props = withDefaults(defineProps<GridItemProps>(), {
|
|
const props = withDefaults(defineProps<GridItemProps>(), {
|
|
|
highlightColor: () => propGetThemeVar('GridItemHighlightColor', 'pressed.white'),
|
|
highlightColor: () => propGetThemeVar('GridItemHighlightColor', 'pressed.white'),
|
|
|
backgroundColor: () => propGetThemeVar('GridItemBackgroundColor', 'white'),
|
|
backgroundColor: () => propGetThemeVar('GridItemBackgroundColor', 'white'),
|
|
@@ -145,14 +133,17 @@ const props = withDefaults(defineProps<GridItemProps>(), {
|
|
|
iconSize: () => propGetThemeVar('GridItemIconSize', 42),
|
|
iconSize: () => propGetThemeVar('GridItemIconSize', 42),
|
|
|
iconStyle: () => propGetThemeVar('GridItemIconStyle', {}),
|
|
iconStyle: () => propGetThemeVar('GridItemIconStyle', {}),
|
|
|
radius: () => propGetThemeVar('GridItemRadius', 0),
|
|
radius: () => propGetThemeVar('GridItemRadius', 0),
|
|
|
- subTitle: () => propGetThemeVar('GridItemSubTitle', false),
|
|
|
|
|
|
|
+ subTitle: () => propGetThemeVar('GridItemSubTitle', ''),
|
|
|
subTitleStyle: () => propGetThemeVar('GridItemSubTitleStyle', {}),
|
|
subTitleStyle: () => propGetThemeVar('GridItemSubTitleStyle', {}),
|
|
|
subTitleColor: () => propGetThemeVar('GridItemSubTitleColor', 'text.second'),
|
|
subTitleColor: () => propGetThemeVar('GridItemSubTitleColor', 'text.second'),
|
|
|
titleColor: () => propGetThemeVar('GridItemTitleColor', 'text.title'),
|
|
titleColor: () => propGetThemeVar('GridItemTitleColor', 'text.title'),
|
|
|
titleStyle: () => propGetThemeVar('GridItemTitleStyle', {}),
|
|
titleStyle: () => propGetThemeVar('GridItemTitleStyle', {}),
|
|
|
innerStyle: () => propGetThemeVar('GridItemStyle', {}),
|
|
innerStyle: () => propGetThemeVar('GridItemStyle', {}),
|
|
|
direction: () => propGetThemeVar('GridItemDirection', inject<any>('gridContext').direction.value),
|
|
direction: () => propGetThemeVar('GridItemDirection', inject<any>('gridContext').direction.value),
|
|
|
-})
|
|
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
|
|
+const emit = defineEmits([ 'click' ]);
|
|
|
|
|
+const themeContext = useTheme();
|
|
|
|
|
|
|
|
const {
|
|
const {
|
|
|
borderWidth,
|
|
borderWidth,
|
|
@@ -167,9 +158,11 @@ const {
|
|
|
const position = computed(() => getPosition());
|
|
const position = computed(() => getPosition());
|
|
|
|
|
|
|
|
const flexDirection = computed(() =>
|
|
const flexDirection = computed(() =>
|
|
|
- (props.direction.startsWith('horizontal') ? 'row' : 'column') + (props.direction.endsWith('-reverse') ? '-reverse' : '')
|
|
|
|
|
|
|
+ (props.direction.startsWith('horizontal') ? 'row' : 'column') +
|
|
|
|
|
+ (props.direction.endsWith('-reverse') ? '-reverse' : '') as FlexDirection
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+
|
|
|
const iconStyle = computed(() => {
|
|
const iconStyle = computed(() => {
|
|
|
return {
|
|
return {
|
|
|
margin: themeContext.resolveThemeSize('GridItemIconMarginVertical', 10) + ' ' + themeContext.resolveThemeSize('GridItemIconMarginHorizontal', 8),
|
|
margin: themeContext.resolveThemeSize('GridItemIconMarginVertical', 10) + ' ' + themeContext.resolveThemeSize('GridItemIconMarginHorizontal', 8),
|
|
@@ -191,11 +184,11 @@ const titleImageStyle = computed(() => {
|
|
|
const style = computed(() => {
|
|
const style = computed(() => {
|
|
|
const o : Record<string, any> = {
|
|
const o : Record<string, any> = {
|
|
|
display: 'flex',
|
|
display: 'flex',
|
|
|
- // #ifdef APP-NVUE || UNI-APP-X
|
|
|
|
|
|
|
+ // #ifdef APP-NVUE
|
|
|
width: itemSize.value,
|
|
width: itemSize.value,
|
|
|
minWidth: itemSize.value,
|
|
minWidth: itemSize.value,
|
|
|
// #endif
|
|
// #endif
|
|
|
- // #ifndef APP-NVUE || UNI-APP-X
|
|
|
|
|
|
|
+ // #ifndef APP-NVUE
|
|
|
flexBasis: itemSize.value,
|
|
flexBasis: itemSize.value,
|
|
|
// #endif
|
|
// #endif
|
|
|
aspectRatio: square.value ? 1 : undefined,
|
|
aspectRatio: square.value ? 1 : undefined,
|
|
@@ -214,4 +207,9 @@ const style = computed(() => {
|
|
|
return o;
|
|
return o;
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+defineOptions({
|
|
|
|
|
+ options: {
|
|
|
|
|
+ virtualHost: true
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
</script>
|
|
</script>
|