mirror of
https://github.com/motajs/template.git
synced 2026-11-27 16:34:31 +08:00
fix: inject 警告
This commit is contained in:
1 parent
95ca4029a6
commit
f9109001fe
4 files changed
+22
-7
No files matched your search
@@ -22,7 +22,10 @@ const iconProps = {
|
||||
|
||||
export const Icon = defineComponent<IIconProps>(props => {
|
||||
const animater = markRaw(new TextureRowAnimater());
|
||||
const defaultMaterials = inject<ITextureManager>('@default/materials');
|
||||
const defaultMaterials = inject<ITextureManager | null>(
|
||||
'@default/materials',
|
||||
null
|
||||
);
|
||||
|
||||
/** 贴图管理器 */
|
||||
const materials = computed(() => props.materials ?? defaultMaterials);
|
||||
|
||||
@@ -342,7 +342,10 @@ export const Selection = defineComponent<SelectionProps>(props => {
|
||||
2000,
|
||||
cosh(2, CurveMode.EaseInOut)
|
||||
)!;
|
||||
const defaultMaterials = inject<ITextureManager>('@default/materials');
|
||||
const defaultMaterials = inject<ITextureManager | null>(
|
||||
'@default/materials',
|
||||
null
|
||||
);
|
||||
|
||||
/** 使用的贴图管理器 */
|
||||
const materials = computed(() => props.materials ?? defaultMaterials);
|
||||
|
||||
@@ -72,7 +72,10 @@ export const ThumbnailCell = defineComponent<
|
||||
ThumbnailCellEmits,
|
||||
keyof ThumbnailCellEmits
|
||||
>((props, { emit }) => {
|
||||
const defaultRenderer = inject<IMapRenderer>('@default/expandMapRenderer');
|
||||
const defaultRenderer = inject<IMapRenderer | null>(
|
||||
'@default/expandMapRenderer',
|
||||
null
|
||||
);
|
||||
/** 使用的地图渲染器 */
|
||||
const mapRenderer = computed(() => props.renderer ?? defaultRenderer);
|
||||
|
||||
@@ -311,7 +314,10 @@ const thumbnailProps = {
|
||||
} satisfies SetupComponentOptions<ThumbnailProps>;
|
||||
|
||||
export const Thumbnail = defineComponent<ThumbnailProps>(props => {
|
||||
const defaultRenderer = inject<IMapRenderer>('@default/expandMapRenderer');
|
||||
const defaultRenderer = inject<IMapRenderer | null>(
|
||||
'@default/expandMapRenderer',
|
||||
null
|
||||
);
|
||||
/** 使用的地图渲染器 */
|
||||
const mapRenderer = computed(() => props.renderer ?? defaultRenderer);
|
||||
/** 空白区域填充样式 */
|
||||
@@ -420,7 +426,7 @@ export const Thumbnail = defineComponent<ThumbnailProps>(props => {
|
||||
<ThumbnailCell
|
||||
loc={chunk.loc}
|
||||
origin={chunk.origin}
|
||||
renderer={mapRenderer.value}
|
||||
renderer={mapRenderer.value ?? void 0}
|
||||
maps={props.maps}
|
||||
floorId={props.floorId}
|
||||
size={size.value}
|
||||
|
||||
@@ -45,7 +45,10 @@ const tipProps = {
|
||||
} satisfies SetupComponentOptions<TipProps>;
|
||||
|
||||
export const Tip = defineComponent<TipProps>((props, { expose }) => {
|
||||
const defaultMaterials = inject<ITextureManager>('@default/materials');
|
||||
const defaultMaterials = inject<ITextureManager | null>(
|
||||
'@default/materials',
|
||||
null
|
||||
);
|
||||
|
||||
/** 贴图管理器 */
|
||||
const materials = computed(() => props.materials ?? defaultMaterials);
|
||||
@@ -149,7 +152,7 @@ export const Tip = defineComponent<TipProps>((props, { expose }) => {
|
||||
/>
|
||||
<Icon
|
||||
icon={icon.value}
|
||||
materials={materials.value}
|
||||
materials={materials.value ?? void 0}
|
||||
hidden={!showIcon.value}
|
||||
loc={iconLoc.value}
|
||||
/>
|
||||
|
||||
Reference in new issue
Block a user