feat: uniform param name

This commit is contained in:
水墨
2020-06-23 11:32:08 +08:00
committed by neverland
parent b788944307
commit eb0a4bb8f9
8 changed files with 31 additions and 29 deletions
+5 -5
View File
@@ -13,7 +13,7 @@ export type SkuHeaderProps = {
goods: SkuGoodsData;
skuEventBus: Vue;
selectedSku: SelectedSkuData;
supportBigPicture: boolean;
showHeaderImage: boolean;
};
export type SkuHeaderSlots = DefaultSlots & {
@@ -55,7 +55,7 @@ function SkuHeader(
goods,
skuEventBus,
selectedSku,
supportBigPicture = false,
showHeaderImage = true,
} = props;
const goodsImg = getSkuImg(sku, selectedSku) || goods.picture;
@@ -64,7 +64,7 @@ function SkuHeader(
};
return (
<div class={[bem(), BORDER_BOTTOM]} {...inherit(ctx)}>
{!supportBigPicture && (
{showHeaderImage && (
<div class={bem('img-wrap')} onClick={previewImage}>
<img src={goodsImg} />
{slots['sku-header-image-extra']?.()}
@@ -73,7 +73,7 @@ function SkuHeader(
<div
class={[
bem('goods-info'),
supportBigPicture && bem('goods-info--no-padding'),
!showHeaderImage && bem('goods-info--no-padding'),
]}
>
{slots.default?.()}
@@ -87,7 +87,7 @@ SkuHeader.props = {
goods: Object,
skuEventBus: Object,
selectedSku: Object,
supportBigPicture: Boolean,
showHeaderImage: Boolean,
};
export default createComponent<SkuHeaderProps>(SkuHeader);
+9 -7
View File
@@ -9,7 +9,7 @@ const [createComponent, bem, t] = createNamespace('sku-row');
export default createComponent({
mixins: [
BindEventMixin(function (bind) {
if (!(this.isShowBigPicture && this.hasScrollTab)) {
if (!(this.largePicturePreview && this.hasScrollTab)) {
return false;
}
@@ -22,7 +22,7 @@ export default createComponent({
],
props: {
skuRow: Object,
isShowBigPicture: {
largePicturePreview: {
type: Boolean,
default: false,
},
@@ -41,7 +41,7 @@ export default createComponent({
},
computed: {
scrollStyle() {
if (!(this.isShowBigPicture && this.hasScrollTab)) {
if (!(this.largePicturePreview && this.hasScrollTab)) {
return false;
}
this.tranX = this.present * 20;
@@ -62,7 +62,7 @@ export default createComponent({
},
mounted() {},
render() {
const { skuRow, isShowBigPicture, hasScrollTab } = this;
const { skuRow, largePicturePreview, hasScrollTab } = this;
const multipleNode = skuRow.is_multiple && (
<span class={bem('title-multiple')}>{t('multiple')}</span>
);
@@ -88,13 +88,15 @@ export default createComponent({
</div>
);
return (
<div class={[bem(), BORDER_BOTTOM, isShowBigPicture && bem('picture')]}>
<div
class={[bem(), BORDER_BOTTOM, largePicturePreview && bem('picture')]}
>
<div class={bem('title')}>
{skuRow.k}
{multipleNode}
</div>
{isShowBigPicture ? SkuContent : this.slots()}
{isShowBigPicture && hasScrollTab && SkuScroll}
{largePicturePreview ? SkuContent : this.slots()}
{largePicturePreview && hasScrollTab && SkuScroll}
</div>
);
},
+4 -4
View File
@@ -13,7 +13,7 @@ export default createComponent({
type: Array,
default: () => [],
},
isShowBigPicture: Boolean,
largePicturePreview: Boolean,
lazyLoad: Boolean,
},
@@ -47,7 +47,7 @@ export default createComponent({
render() {
const choosed = this.skuValue.id === this.selectedSku[this.skuKeyStr];
const imgUrl = this.skuValue.imgUrl || this.skuValue.img_url;
const BEM_NAME = this.isShowBigPicture
const BEM_NAME = this.largePicturePreview
? 'van-sku-row__picture-item'
: 'van-sku-row__item';
@@ -60,7 +60,7 @@ export default createComponent({
]}
onClick={this.onSelect}
>
{this.isShowBigPicture && (
{this.largePicturePreview && (
<img
class={`${BEM_NAME}-img-icon`}
src="https://img.yzcdn.cn/upload_files/2020/06/18/Fn6Qf0fGRFyuD8xh0Gi1w2ng59G1.png"
@@ -68,7 +68,7 @@ export default createComponent({
/>
)}
{imgUrl &&
(this.isShowBigPicture && this.lazyLoad ? (
(this.largePicturePreview && this.lazyLoad ? (
<img class={`${BEM_NAME}-img`} src={imgUrl} vLazy={imgUrl} />
) : (
<img class={`${BEM_NAME}-img`} src={imgUrl} />