Merge branch 'dev' into feature/vant_cli_2

This commit is contained in:
陈嘉涵
2019-12-11 11:31:57 +08:00
22 changed files with 372 additions and 315 deletions
+25 -15
View File
@@ -60,28 +60,36 @@ function AddressItem(
/>
);
const genContent = () => {
function genTag() {
if (props.data.isDefault && props.defaultTagText) {
return (
<Tag type="danger" round class={bem('tag')}>
{props.defaultTagText}
</Tag>
);
}
}
function genContent() {
const { data } = props;
const Info = [
<div class={bem('name')}>
{`${data.name} ${data.tel}`}
{data.isDefault && props.defaultTagText && (
<Tag type="danger" round class={bem('tag')}>
{props.defaultTagText}
</Tag>
)}
{genTag()}
</div>,
<div class={bem('address')}>{data.address}</div>
];
return switchable && !disabled ? (
<Radio name={data.id} iconSize={16}>
{Info}
</Radio>
) : (
Info
);
};
if (switchable && !disabled) {
return (
<Radio name={data.id} iconSize={16}>
{Info}
</Radio>
);
}
return Info;
}
return (
<Cell
@@ -106,4 +114,6 @@ AddressItem.props = {
defaultTagText: String
};
export default createComponent<AddressItemProps, AddressItemEvents>(AddressItem);
export default createComponent<AddressItemProps, AddressItemEvents>(
AddressItem
);
+1 -1
View File
@@ -123,7 +123,7 @@ function Card(
const priceArr = props.price!.toString().split('.');
return (
<div>
{props.currency}
<span class={bem('price-currency')}>{props.currency}</span>
<span class={bem('price-integer')}>{priceArr[0]}</span>.
<span class={bem('price-decimal')}>{priceArr[1]}</span>
</div>
@@ -17,7 +17,7 @@ exports[`renders demo correctly 1`] = `
</div>
<div class="van-card__bottom">
<div class="van-card__price">
<div>¥<span class="van-card__price-integer">2</span>.<span class="van-card__price-decimal">00</span></div>
<div><span class="van-card__price-currency">¥</span><span class="van-card__price-integer">2</span>.<span class="van-card__price-decimal">00</span></div>
</div>
<div class="van-card__num">x2</div>
</div>
@@ -41,7 +41,7 @@ exports[`renders demo correctly 1`] = `
</div>
<div class="van-card__bottom">
<div class="van-card__price">
<div>¥<span class="van-card__price-integer">2</span>.<span class="van-card__price-decimal">00</span></div>
<div><span class="van-card__price-currency">¥</span><span class="van-card__price-integer">2</span>.<span class="van-card__price-decimal">00</span></div>
</div>
<div class="van-card__origin-price">¥ 10.00</div>
<div class="van-card__num">x2</div>
@@ -70,7 +70,7 @@ exports[`renders demo correctly 1`] = `
</div>
<div class="van-card__bottom">
<div class="van-card__price">
<div>¥<span class="van-card__price-integer">2</span>.<span class="van-card__price-decimal">00</span></div>
<div><span class="van-card__price-currency">¥</span><span class="van-card__price-integer">2</span>.<span class="van-card__price-decimal">00</span></div>
</div>
<div class="van-card__num">x2</div>
</div>
+10 -4
View File
@@ -10,7 +10,7 @@ import { DefaultSlots } from '../utils/types';
export type IconProps = {
dot?: boolean;
tag: keyof HTMLElementTagNameMap | string;
name: string;
name?: string;
size?: string | number;
color?: string;
info?: string | number;
@@ -27,17 +27,23 @@ function isImage(name?: string): boolean {
return name ? name.indexOf('/') !== -1 : false;
}
// compatible with legacy usage, should be removed in next major version
function correctName(name?: string) {
return name === 'medel' ? 'medal' : name;
}
function Icon(
h: CreateElement,
props: IconProps,
slots: DefaultSlots,
ctx: RenderContext<IconProps>
) {
const imageIcon = isImage(props.name);
const name = correctName(props.name);
const imageIcon = isImage(name);
return (
<props.tag
class={[props.classPrefix, imageIcon ? '' : `${props.classPrefix}-${props.name}`]}
class={[props.classPrefix, imageIcon ? '' : `${props.classPrefix}-${name}`]}
style={{
color: props.color,
fontSize: addUnit(props.size)
@@ -46,7 +52,7 @@ function Icon(
>
{slots.default && slots.default()}
{imageIcon && (
<Image class={bem('image')} fit="contain" src={props.name} showLoading={false} />
<Image class={bem('image')} fit="contain" src={name} showLoading={false} />
)}
<Info dot={props.dot} info={props.info} />
</props.tag>
+1 -1
View File
@@ -89,7 +89,7 @@ declare global {
}
}
const version = '2.3.0-beta.2';
const version = '2.3.0-beta.3';
const components = [
ActionSheet,
AddressEdit,
+2 -1
View File
@@ -277,13 +277,14 @@ export default createComponent({
resetStepper() {
const { skuStepper } = this.$refs;
const { selectedNum } = this.initialSku;
const num = isDef(selectedNum) ? selectedNum : 1;
const num = isDef(selectedNum) ? selectedNum : this.startSaleNum;
// 用来缓存不合法的情况
this.stepperError = null;
if (skuStepper) {
skuStepper.setCurrentNum(num);
} else {
// 当首次加载(skuStepper 为空)时,传入数量如果不合法,可能会存在问题
this.selectedNum = num;
}
},
+1
View File
@@ -112,6 +112,7 @@ export default createComponent({
methods: {
setCurrentNum(num) {
this.currentNum = num;
this.checkState(this.stepperMinLimit, this.stepperLimit);
},
onOverLimit(action) {
+7 -2
View File
@@ -41,12 +41,17 @@ function SubmitBar(
function Text() {
if (typeof price === 'number') {
const priceArr = (price / 100).toFixed(props.decimalLength).split('.');
const decimalStr = props.decimalLength ? `.${priceArr[1]}` : '';
return (
<div style={{ textAlign: props.textAlign ? props.textAlign : '' }} class={bem('text')}>
<div
style={{ textAlign: props.textAlign ? props.textAlign : '' }}
class={bem('text')}
>
<span>{props.label || t('label')}</span>
<span class={bem('price')}>
{props.currency}
<span class={bem('price', 'integer')}>{priceArr[0]}</span>.{priceArr[1]}
<span class={bem('price', 'integer')}>{priceArr[0]}</span>
{decimalStr}
</span>
{props.suffixLabel && (
<span class={bem('suffix-label')}>{props.suffixLabel}</span>
+1 -1
View File
@@ -65,7 +65,7 @@ use `loading` property to keep component in loading state
| cell-size | Cell sizecan be set to `large` | *string* | - | - |
| loading | whether switch is loading | *boolean* | `false` | - |
| disabled | whether to disable switch | *boolean* | `false` | - |
| size | Size of switch | *string* | `24px` | - |
| size | Size of switch | *string \| number* | `24px` | - |
| active-color | Background of switch color when active | *string* | `#1989fa` | - |
| inactive-color | Background of switch color when inactive | *string* | `#fff` | - |
| active-value | Value when active | *any* | `true` | - |
+1 -1
View File
@@ -65,7 +65,7 @@ export default {
| cell-size | 单元格大小,可选值为 `large` | *string* | - |
| loading | 是否为加载状态 | *boolean* | `false` | - |
| disabled | 是否为禁用状态 | *boolean* | `false` | - |
| size | 开关尺寸 | *string* | `24px` | - |
| size | 开关尺寸 | *string \| number* | `24px` | - |
| active-color | 开关时的背景色 | *string* | `#1989fa` | - |
| inactive-color | 开关时的背景色 | *string* | `#fff` | - |
| active-value | 打开时的值 | *any* | `true` | - |
+2 -2
View File
@@ -3,7 +3,7 @@
*/
export type SharedSwitchProps = {
size: string;
size?: string | number;
value?: any;
loading?: boolean;
disabled?: boolean;
@@ -14,7 +14,7 @@ export type SharedSwitchProps = {
};
export const switchProps = {
size: String,
size: [String, Number],
value: null as any,
loading: Boolean,
disabled: Boolean,
+2 -2
View File
@@ -99,7 +99,7 @@ function TreeSelect(
emit(ctx, 'update:active-id', newActiveId);
emit(ctx, 'click-item', item);
// compatible for old usage, should be removed in next major version
// compatible with legacy usage, should be removed in next major version
emit(ctx, 'itemclick', item);
}
}}
@@ -120,7 +120,7 @@ function TreeSelect(
onChange={(index: number) => {
emit(ctx, 'update:main-active-index', index);
emit(ctx, 'click-nav', index);
// compatible for old usage, should be removed in next major version
// compatible with legacy usage, should be removed in next major version
emit(ctx, 'navclick', index);
}}
>