uniapp【修复】: 调整navbar属性可为空,解决App真机调试出现很多必须属性警告

uniapp【修复】: 调整navbar属性可为空,解决App真机调试出现很多必须属性警告
This commit is contained in:
21世纪小八路
2024-11-03 14:10:30 +08:00
committed by 15093570141
parent d0c5769902
commit 76f07714af
54 changed files with 163 additions and 166 deletions

View File

@@ -16,8 +16,8 @@
import { handleAdvertiseDetail } from '@/core/utils';
const props = withDefaults(defineProps<{
code : string,
height : string
code ?: string,
height ?: string
}>(), {
code: '',
height: '200rpx'

View File

@@ -18,7 +18,7 @@
import { handleStaticResources } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -10,11 +10,11 @@
const emits = defineEmits(['onClick']);
const props = withDefaults(defineProps<{
title : string;
title ?: string;
radius ?: number;
backgroundColor ?: string;
color ?: string;
loading : boolean;
loading ?: boolean;
customStyle ?: { [key : string] : any }
}>(), {
title: '保存',

View File

@@ -2,15 +2,15 @@
<uv-empty :mode="props.mode" :text="props.text" :textColor="props.textColor" :icon="computedSrc"></uv-empty>
</template>
<script setup lang="ts">
<script setup lang="ts">
import { computed } from 'vue';
import { EmptyEnum } from '@/core/enum';
import { cdnFilesUrl } from '@/core/consts';
const props = withDefaults(defineProps<{
mode : EmptyEnum;
text : string;
textColor : string;
mode ?: EmptyEnum;
text ?: string;
textColor ?: string;
}>(), {
mode: EmptyEnum.data,
text: '数据为空',

View File

@@ -1,5 +1,5 @@
<template>
<view :class="props.type == 'horizontal' ? 'horizontal-good-card-box' : 'vertical-good-card-box'">
<view :class="props.type == 'horizontal' ? 'horizontal-good-card-box' : 'vertical-good-card-box'" >
<view class="img-box" :style="{ 'width': props.imgWidth, 'height': props.imgHeight }" @click="hanldeClickGoods">
<image class="good-img" :src="props.goodsData.image"></image>
<view class="recommend" v-if="props.goodsData.isRecommend">推荐</view>
@@ -38,12 +38,12 @@
</template>
<script setup lang="ts">
const props = withDefaults(defineProps<{
type : 'vertical' | 'horizontal',
imgWidth : string,
imgHeight : string,
nameOverflow : number,
briefOverflow : number,
goodsData : any,
type ?: 'vertical' | 'horizontal',
imgWidth ?: string,
imgHeight ?: string,
nameOverflow ?: number,
briefOverflow ?: number,
goodsData ?: any,
}>(), {
type: 'horizontal', // vertical 垂直 horizontal 水平
imgWidth: '190rpx',

View File

@@ -69,8 +69,8 @@
const userInfoStore = useUserInfoStore();
const props = withDefaults(defineProps<{
show : boolean,
goodsDetailData : any,
show ?: boolean,
goodsDetailData ?: any,
}>(), {
show: false,
goodsDetailData: {},

View File

@@ -26,13 +26,13 @@
const { menuButtonHeight } = useSystemInfo();
const props = withDefaults(defineProps<{
isBack : boolean,
bgColor : string,
titleColor : string,
mode : string,
title : string,
handleCustomRouteJump : () => void | null,
placeholder : boolean;
isBack ?: boolean,
bgColor ?: string,
titleColor ?: string,
mode ?: string,
title ?: string,
handleCustomRouteJump ?: () => void | null,
placeholder ?: boolean;
}>(), {
isBack: true,
bgColor: '#eef2f6',

View File

@@ -19,17 +19,17 @@
const _useLoginStore = useLoginStore();
const props = withDefaults(defineProps<{
isBack : boolean,
bgColor : string,
titleColor : string,
mode : string,
title : string,
isShowStatusBarHeight : boolean;
customStyle : any;
contentStyle : any;
handleCustomRouteJump : () => void | null,
showLoginModalDom : boolean;
placeholder : boolean;
isBack ?: boolean,
bgColor ?: string,
titleColor ?: string,
mode ?: "left" | "center",
title ?: string,
isShowStatusBarHeight ?: boolean;
customStyle ?: any;
contentStyle ?: any;
handleCustomRouteJump ?: () => void | null,
showLoginModalDom ?: boolean;
placeholder ?: boolean;
}>(), {
isBack: true,
bgColor: '#eef2f6',

View File

@@ -20,26 +20,26 @@
</template>
<script setup lang="ts">
const props = withDefaults(defineProps<{
isBack : boolean,
bgColor : string,
titleColor : string,
mode : string,
title : string;
isShowStatusBarHeight : boolean;
customStyle : any;
contentStyle : any;
handleCustomRouteJump : () => void | null,
showLoginModalDom : boolean;
needSkeleton : boolean;
isBack ?: boolean,
bgColor ?: string,
titleColor ?: string,
mode ?: "left" | "center",
title ?: string;
isShowStatusBarHeight ?: boolean;
customStyle ?: any;
contentStyle ?: any;
handleCustomRouteJump ?: () => void | null,
showLoginModalDom ?: boolean;
needSkeleton ?: boolean;
skeleton ?: Array<{ [key : string] : any }>;
skeletonLoading : boolean;
placeholder : boolean;
loadingPage : boolean;
needLoadingPage : boolean;
loadingText : string;
loadingTextFontSize : string;
loadingBgColor : string;
loadingColor : string;
skeletonLoading ?: boolean;
placeholder ?: boolean;
loadingPage ?: boolean;
needLoadingPage ?: boolean;
loadingText ?: string;
loadingTextFontSize ?: string;
loadingBgColor ?: string;
loadingColor ?: string;
}>(), {
isBack: true,
bgColor: '#eef2f6',
@@ -67,4 +67,4 @@
.coreshop-skeleton {
background-color: #fff;
}
</style>
</style>

View File

@@ -8,9 +8,9 @@
import { queryAreas } from '@/core/api';
const props = withDefaults(defineProps<{
show : boolean,
cityList : Array<CityAddressType>,
pickerValue : string,
show ?: boolean,
cityList ?: Array<CityAddressType>,
pickerValue ?: string,
}>(), {
show: false,
cityList: () => [],

View File

@@ -28,9 +28,9 @@
const sharePpopup = ref();
const props = withDefaults(defineProps<{
goodsDetailData : any,
show : boolean,
shareType : number,
goodsDetailData ?: any,
show ?: boolean,
shareType ?: number,
}>(), {
goodsDetailData: {},
show: false,

View File

@@ -17,9 +17,9 @@
const instance = getCurrentInstance();
const props = withDefaults(defineProps<{
current : number,
keyNname : string,
list : Array<any>,
current ?: number,
keyNname ?: string,
list ?: Array<any>,
}>(), {
current: 0,
keyNname: 'name',

View File

@@ -8,8 +8,8 @@
</template>
<script setup lang="ts">
const props = withDefaults(defineProps<{
title : string,
color : string,
title ?: string,
color ?: string,
}>(), {
title: '查看更多',
color: '#6E737D'

View File

@@ -139,9 +139,9 @@
const _useLoginStore = useLoginStore();
const props = withDefaults(defineProps<{
data : Array<CategoriesType>,
height : number,
statusBarHeight : number,
data ?: Array<CategoriesType>,
height ?: number,
statusBarHeight ?: number,
}>(), {
data: () => [],
height: 0,
@@ -225,16 +225,16 @@
})
nextTick(async () => {
state.bigClassifyH = ((await getDomInfo('.big-classify', instance.proxy)) as { height : number }).height;
state.bigClassifyH = ((await getDomInfo('.big-classify', instance.proxy)) as { height : number }).height;
setTimeout(async () => {
state.rightTabH = ((await getDomInfo('.right-tab-box', instance.proxy)) as { height : number }).height;
state.rightTabH = ((await getDomInfo('.right-tab-box', instance.proxy)) as { height : number }).height;
}, 100)
})
})
// 获取商品列表数据
const getGoodsPageList = async () => {
const goodsPageList : Response<GoodsListType> = await queryGoodsPageList({
page: state.page,
limit: 10,

View File

@@ -89,8 +89,8 @@
const _useLoginStore = useLoginStore();
const props = withDefaults(defineProps<{
data : Array<CategoriesType>,
height : number,
data ?: Array<CategoriesType>,
height ?: number,
}>(), {
data: () => [],
height: 0,
@@ -158,7 +158,7 @@
/** 获取商品列表数据 */
const getGoodsPageList = async () => {
const goodsPageList : Response<GoodsListType> = await queryGoodsPageList({
page: state.page,
limit: 10,

View File

@@ -12,7 +12,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : Array<CategoriesType>,
data ?: Array<CategoriesType>,
}>(), {
data: () => [],
});

View File

@@ -35,8 +35,8 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : Array<CategoriesType>,
height : number,
data ?: Array<CategoriesType>,
height ?: number,
}>(), {
data: () => [],
height: 0,

View File

@@ -12,7 +12,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : Array<CategoriesType>,
data ?: Array<CategoriesType>,
}>(), {
data: () => [],
});

View File

@@ -16,7 +16,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {}
});

View File

@@ -16,7 +16,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {}
});

View File

@@ -5,7 +5,7 @@
</template>
<script setup lang="ts">
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {}
});

View File

@@ -5,7 +5,7 @@
</template>
<script setup lang="ts">
const props = withDefaults(defineProps<{
data : string,
data ?: string,
}>(), {
data: ''
});

View File

@@ -39,7 +39,7 @@
const _useLoginStore = useLoginStore();
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {}
});

View File

@@ -51,7 +51,7 @@
import { handleRouteNavigateTo, splitArrayByStep } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -81,7 +81,7 @@
import { handleRouteNavigateTo, toDimensionArray, splitArrayByStep } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {}
});

View File

@@ -26,9 +26,9 @@
const shopConfigStore = useShopConfigStore();
const props = withDefaults(defineProps<{
data : any,
flex : boolean,
fontSize : string,
data ?: any,
flex ?: boolean,
fontSize ?: string,
}>(), {
data: {},
flex: false,

View File

@@ -51,7 +51,7 @@
import { handleStaticResources, handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -47,7 +47,7 @@
import { handleStaticResources, handleAdvertiseDetail } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -13,7 +13,7 @@
import type { PageConfigItemsImgSlideType } from '@/core/models';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -12,7 +12,7 @@
import { handleAdvertiseDetail } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -11,7 +11,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -33,7 +33,7 @@
import { handleStaticResources, handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -17,7 +17,7 @@
import { onHomePageShow } from '@/core/consts';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -11,7 +11,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -49,7 +49,7 @@
import { handleStaticResources, handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -14,11 +14,7 @@
}
.card-box {
margin-top: 35rpx;
.goods-card {
width: 100%;
}
margin-top: 35rpx;
.price-tag-box {
display: flex;

View File

@@ -6,7 +6,7 @@
</view>
<view class="card-box" v-for="item, index in props.data.list" :key="index">
<coreshop-goods-card class="goods-card" :goodsData="hanldeCombinationGoodsData(item)"
<coreshop-goods-card :goodsData="hanldeCombinationGoodsData(item)"
@hanldeClickGoods="hanldeClickGoods">
<template #goodTag>
<view class="price-tag-box" @click="hanldeClickGoods(item)">
@@ -43,7 +43,7 @@
import { handleRouteNavigateTo } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -12,13 +12,13 @@
import { handleAdvertiseDetail } from '@/core/utils';
const props = withDefaults(defineProps<{
data : any,
dotsSelect : boolean,
autoplaySelect : boolean,
intervalSelect : number,
circularSelect : boolean,
indicatorColor : string,
indicatorColorActive : string,
data ?: any,
dotsSelect ?: boolean,
autoplaySelect ?: boolean,
intervalSelect ?: number,
circularSelect ?: boolean,
indicatorColor ?: string,
indicatorColorActive ?: string,
}>(), {
data: {},
dotsSelect: true,

View File

@@ -6,7 +6,7 @@
<script setup lang="ts">
import HomeContent from '../home-content/home-content.vue';
const props = withDefaults(defineProps<{
data : string,
data ?: string,
}>(), {
data: '',
});

View File

@@ -7,7 +7,7 @@
import { ref, onMounted } from 'vue';
const props = withDefaults(defineProps<{
data : any,
data ?: any,
}>(), {
data: {},
});

View File

@@ -75,7 +75,7 @@
// import HomeAdpop from './components/home-adpop/home-adpop.vue';
const props = withDefaults(defineProps<{
coreshopData : Array<PageConfigItemsType>,
coreshopData ?: Array<PageConfigItemsType>,
}>(), {
coreshopData: () => []
});

View File

@@ -50,8 +50,8 @@
import type { GoodsAgentListType } from "@/core/models";
const props = withDefaults(defineProps<{
userAgentGrade : any,
agentProductsList : Array<GoodsAgentListType>,
userAgentGrade ?: any,
agentProductsList ?: Array<GoodsAgentListType>,
}>(), {
userAgentGrade: {},
agentProductsList: () => [],

View File

@@ -41,7 +41,7 @@
import { useCartStore } from '@/core/store';
const props = withDefaults(defineProps<{
price : number,
price ?: number,
}>(), {
price: 0,
});

View File

@@ -16,7 +16,7 @@
import type { CommonQuestionServiceType } from "@/core/models";
const props = withDefaults(defineProps<{
commonQuestion : Array<CommonQuestionServiceType>,
commonQuestion ?: Array<CommonQuestionServiceType>,
}>(), {
commonQuestion: () => [],
});

View File

@@ -12,7 +12,7 @@
<script setup lang="ts">
const props = withDefaults(defineProps<{
goodsDetailContent : string,
goodsDetailContent ?: string,
}>(), {
goodsDetailContent: '',
});

View File

@@ -32,9 +32,9 @@
import { handleRouteNavigateTo } from "@/core/utils";
const props = withDefaults(defineProps<{
commentsCount : number,
commentsList : Array<GoodsPictureListType>,
id : number;
commentsCount ?: number,
commentsList ?: Array<GoodsPictureListType>,
id ?: number;
}>(), {
commentsCount: 0,
commentsList: () => [],

View File

@@ -87,9 +87,9 @@
const _useLoginStore = useLoginStore();
const props = withDefaults(defineProps<{
goodsDetailData : any,
isActivityGoods : boolean,
shareType : ShareEnum,
goodsDetailData ?: any,
isActivityGoods ?: boolean,
shareType ?: ShareEnum,
}>(), {
goodsDetailData: {},
isActivityGoods: false,

View File

@@ -17,7 +17,7 @@
import type { GoodsParamsType } from "@/core/models";
const props = withDefaults(defineProps<{
goodsParamsList : Array<GoodsParamsType>,
goodsParamsList ?: Array<GoodsParamsType>,
}>(), {
goodsParamsList: () => [],
});

View File

@@ -12,8 +12,8 @@
<script setup lang="ts">
const props = withDefaults(defineProps<{
swiperBanner : Array<string>,
video : string,
swiperBanner ?: Array<string>,
video ?: string,
}>(), {
swiperBanner: () => [],
video: '',

View File

@@ -35,7 +35,7 @@
import Point from '@/pages/components/custom-page/components/home-goods/point.vue';
const props = withDefaults(defineProps<{
queryParams : any,
queryParams ?: any,
}>(), {
queryParams: {
id: 10,

View File

@@ -111,11 +111,11 @@
import type { GoodsPromotionType, CommonQuestionServiceType } from "@/core/models";
const props = withDefaults(defineProps<{
isCustomService : boolean,
goodsPromotionList : Array<GoodsPromotionType>,
delivery : Array<CommonQuestionServiceType>,
service : Array<CommonQuestionServiceType>,
spesDesc : string,
isCustomService ?: boolean,
goodsPromotionList ?: Array<GoodsPromotionType>,
delivery ?: Array<CommonQuestionServiceType>,
service ?: Array<CommonQuestionServiceType>,
spesDesc ?: string,
}>(), {
isCustomService: false,
goodsPromotionList: () => [],

View File

@@ -32,13 +32,14 @@
<view class="btn-box">
<!-- <view v-if="props.isShowAddCartBtn" class="btn add-cart" @click="handleAddCart">加入购物车</view> -->
<view v-if="props.isShowAddCartBtn" class="core-button-confirm add-cart">
<coreshop-button :loading="props.addCartloading" class="core-button-confirm_" :radius="0" title="加入购物车"
:customStyle="addCartCustomStyle" @onClick="handleAddCart()"></coreshop-button>
<coreshop-button :loading="props.addCartloading" class="core-button-confirm_" :radius="0"
title="加入购物车" :customStyle="addCartCustomStyle" @onClick="handleAddCart()"></coreshop-button>
</view>
<!-- <view class="btn buy-now" @click="handleBuyNow">{{ props.btnBuyTitlt }}</view> -->
<view class="core-button-confirm">
<coreshop-button :loading="props.buyNowNowloading" class="core-button-confirm_" :radius="0"
:title="props.btnBuyTitlt" :customStyle="buyNowCustomStyle" @onClick="handleBuyNow()"></coreshop-button>
:title="props.btnBuyTitlt" :customStyle="buyNowCustomStyle"
@onClick="handleBuyNow()"></coreshop-button>
</view>
</view>
</view>
@@ -69,14 +70,14 @@
const props = withDefaults(defineProps<{
showSku : boolean,
goodsDetailData : any,
isShowAddCartBtn : boolean,
btnBuyTitlt : string,
safeAreaInsetBottom : boolean;
buyNowCustomStyle : { [key : string] : any },
buyNowNowloading : boolean,
addCartloading : boolean
showSku ?: boolean,
goodsDetailData ?: any,
isShowAddCartBtn ?: boolean,
btnBuyTitlt ?: string,
safeAreaInsetBottom ?: boolean;
buyNowCustomStyle ?: { [key : string] : any },
buyNowNowloading ?: boolean,
addCartloading ?: boolean
}>(), {
showSku: false,
goodsDetailData: {},

View File

@@ -8,7 +8,7 @@
<slot name="tip"></slot>
<!-- 商品信息 价格名字之类的 -->
<GoodsDetailInfo :goodsDetailData="props.goodsDetailData" :shareType="props.shareType"
<GoodsDetailInfo :goodsDetailData="props.goodsDetailData" :shareType="props.shareType"
:isActivityGoods="props.isActivityGoods" @handleToggleGoodsCollection="handleToggleGoodsCollection">
<template #countDown>
<slot name="countDown"></slot>
@@ -68,17 +68,17 @@
import type { Response, CommonQuestionServiceType, GoodsPictureType, GoodsPictureListType, GoodsParamsType, GoodsAgentListType, GoodsPromotionType } from "@/core/models";
const props = withDefaults(defineProps<{
isActivityGoods : boolean,
goodsId : number,
goodsDetailData : any,
swiperBanner : Array<any>,
goodsDetailContent : string,
userAgentGrade : any,
agentProductsList : Array<GoodsAgentListType>,
goodsPromotionList : Array<GoodsPromotionType>,
spesDesc : string,
isCustomService : boolean,
shareType : ShareEnum,
isActivityGoods ?: boolean,
goodsId ?: number,
goodsDetailData ?: any,
swiperBanner ?: Array<any>,
goodsDetailContent ?: string,
userAgentGrade ?: any,
agentProductsList ?: Array<GoodsAgentListType>,
goodsPromotionList ?: Array<GoodsPromotionType>,
spesDesc ?: string,
isCustomService ?: boolean,
shareType ?: ShareEnum,
}>(), {
isActivityGoods: false, /** 是否是活动商品 */
goodsId: 0, /** 商品id */
@@ -169,7 +169,7 @@
/** 商品收藏 */
const handleToggleGoodsCollection = () => {
emits('handleToggleGoodsCollection')
}
}
</script>
<style lang="scss" scoped></style>

View File

@@ -26,15 +26,15 @@
import { queryPay } from '@/core/api';
const props = withDefaults(defineProps<{
payMethodList : Array<PayMethodListType>,
orderType : PaymentTypeEnum,
orderId : number,
recharge : number,
userInfo : any,
payMethodList ?: Array<PayMethodListType>,
orderType ?: PaymentTypeEnum,
orderId ?: string,
recharge ?: number,
userInfo ?: any,
}>(), {
payMethodList: () => [],
orderType: PaymentTypeEnum.common,
orderId: 0, /** 如果是商品订单此参数必须 */
orderId: '', /** 如果是商品订单此参数必须 */
recharge: 0, /** 如果是充值订单此参数必须 */
userInfo: {},
});