mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-21 13:59:15 +08:00
Merge branch 'dev' into hotfix/calendar_0708
This commit is contained in:
commit
1662e08834
62
dist/calendar/index.js
vendored
62
dist/calendar/index.js
vendored
@ -1,7 +1,9 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import {
|
import {
|
||||||
ROW_HEIGHT,
|
ROW_HEIGHT,
|
||||||
|
getPrevDay,
|
||||||
getNextDay,
|
getNextDay,
|
||||||
|
getToday,
|
||||||
compareDay,
|
compareDay,
|
||||||
copyDates,
|
copyDates,
|
||||||
calcDateNum,
|
calcDateNum,
|
||||||
@ -12,6 +14,15 @@ import {
|
|||||||
} from './utils';
|
} from './utils';
|
||||||
import Toast from '../toast/toast';
|
import Toast from '../toast/toast';
|
||||||
import { requestAnimationFrame } from '../common/utils';
|
import { requestAnimationFrame } from '../common/utils';
|
||||||
|
const initialMinDate = getToday().getTime();
|
||||||
|
const initialMaxDate = (() => {
|
||||||
|
const now = getToday();
|
||||||
|
return new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth() + 6,
|
||||||
|
now.getDate()
|
||||||
|
).getTime();
|
||||||
|
})();
|
||||||
VantComponent({
|
VantComponent({
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
@ -54,15 +65,11 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
minDate: {
|
minDate: {
|
||||||
type: null,
|
type: null,
|
||||||
value: Date.now(),
|
value: initialMinDate,
|
||||||
},
|
},
|
||||||
maxDate: {
|
maxDate: {
|
||||||
type: null,
|
type: null,
|
||||||
value: new Date(
|
value: initialMaxDate,
|
||||||
new Date().getFullYear(),
|
|
||||||
new Date().getMonth() + 6,
|
|
||||||
new Date().getDate()
|
|
||||||
).getTime(),
|
|
||||||
},
|
},
|
||||||
position: {
|
position: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -151,19 +158,46 @@ VantComponent({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getInitialDate() {
|
limitDateRange(date, minDate = null, maxDate = null) {
|
||||||
const { type, defaultDate, minDate } = this.data;
|
minDate = minDate || this.data.minDate;
|
||||||
|
maxDate = maxDate || this.data.maxDate;
|
||||||
|
if (compareDay(date, minDate) === -1) {
|
||||||
|
return minDate;
|
||||||
|
}
|
||||||
|
if (compareDay(date, maxDate) === 1) {
|
||||||
|
return maxDate;
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
getInitialDate(defaultDate = null) {
|
||||||
|
const { type, minDate, maxDate } = this.data;
|
||||||
|
const now = getToday().getTime();
|
||||||
if (type === 'range') {
|
if (type === 'range') {
|
||||||
|
if (!Array.isArray(defaultDate)) {
|
||||||
|
defaultDate = [];
|
||||||
|
}
|
||||||
const [startDay, endDay] = defaultDate || [];
|
const [startDay, endDay] = defaultDate || [];
|
||||||
return [
|
const start = this.limitDateRange(
|
||||||
startDay || minDate,
|
startDay || now,
|
||||||
endDay || getNextDay(new Date(minDate)).getTime(),
|
minDate,
|
||||||
];
|
getPrevDay(maxDate).getTime()
|
||||||
|
);
|
||||||
|
const end = this.limitDateRange(
|
||||||
|
endDay || now,
|
||||||
|
getNextDay(minDate).getTime()
|
||||||
|
);
|
||||||
|
return [start, end];
|
||||||
}
|
}
|
||||||
if (type === 'multiple') {
|
if (type === 'multiple') {
|
||||||
return defaultDate || [minDate];
|
if (Array.isArray(defaultDate)) {
|
||||||
|
return defaultDate.map((date) => this.limitDateRange(date));
|
||||||
|
}
|
||||||
|
return [this.limitDateRange(now)];
|
||||||
}
|
}
|
||||||
return defaultDate || minDate;
|
if (!defaultDate || Array.isArray(defaultDate)) {
|
||||||
|
defaultDate = now;
|
||||||
|
}
|
||||||
|
return this.limitDateRange(defaultDate);
|
||||||
},
|
},
|
||||||
scrollIntoView() {
|
scrollIntoView() {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
|
1
dist/calendar/utils.d.ts
vendored
1
dist/calendar/utils.d.ts
vendored
@ -11,6 +11,7 @@ export declare function compareDay(
|
|||||||
export declare function getDayByOffset(date: Date, offset: number): Date;
|
export declare function getDayByOffset(date: Date, offset: number): Date;
|
||||||
export declare function getPrevDay(date: Date): Date;
|
export declare function getPrevDay(date: Date): Date;
|
||||||
export declare function getNextDay(date: Date): Date;
|
export declare function getNextDay(date: Date): Date;
|
||||||
|
export declare function getToday(): Date;
|
||||||
export declare function calcDateNum(date: [Date, Date]): number;
|
export declare function calcDateNum(date: [Date, Date]): number;
|
||||||
export declare function copyDates(dates: Date | Date[]): Date | Date[];
|
export declare function copyDates(dates: Date | Date[]): Date | Date[];
|
||||||
export declare function getMonthEndDay(year: number, month: number): number;
|
export declare function getMonthEndDay(year: number, month: number): number;
|
||||||
|
5
dist/calendar/utils.js
vendored
5
dist/calendar/utils.js
vendored
@ -47,6 +47,11 @@ export function getPrevDay(date) {
|
|||||||
export function getNextDay(date) {
|
export function getNextDay(date) {
|
||||||
return getDayByOffset(date, 1);
|
return getDayByOffset(date, 1);
|
||||||
}
|
}
|
||||||
|
export function getToday() {
|
||||||
|
const today = new Date();
|
||||||
|
today.setHours(0, 0, 0, 0);
|
||||||
|
return today;
|
||||||
|
}
|
||||||
export function calcDateNum(date) {
|
export function calcDateNum(date) {
|
||||||
const day1 = new Date(date[0]).getTime();
|
const day1 = new Date(date[0]).getTime();
|
||||||
const day2 = new Date(date[1]).getTime();
|
const day2 = new Date(date[1]).getTime();
|
||||||
|
1
dist/cell-group/index.js
vendored
1
dist/cell-group/index.js
vendored
@ -6,5 +6,6 @@ VantComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
|
inset: Boolean,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
6
dist/cell-group/index.wxml
vendored
6
dist/cell-group/index.wxml
vendored
@ -1,9 +1,11 @@
|
|||||||
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
wx:if="{{ title }}"
|
wx:if="{{ title }}"
|
||||||
class="van-cell-group__title"
|
class="{{ utils.bem('cell-group__title', { inset }) }}"
|
||||||
>
|
>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</view>
|
</view>
|
||||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
|
2
dist/cell-group/index.wxss
vendored
2
dist/cell-group/index.wxss
vendored
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}
|
@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)}
|
@ -1,5 +1,19 @@
|
|||||||
# 更新日志
|
# 更新日志
|
||||||
|
|
||||||
|
|
||||||
|
### [1.7.2](https://github.com/youzan/vant-weapp/tree/v1.7.2)
|
||||||
|
|
||||||
|
`2021-07-19`
|
||||||
|
|
||||||
|
**Bug Fixes**
|
||||||
|
|
||||||
|
- Calendar: 初始日期设置为当前日期 [#4339](https://github.com/youzan/vant-weapp/issues/4339)
|
||||||
|
|
||||||
|
**Features**
|
||||||
|
|
||||||
|
- Cell: CellGroup 新增 inset 属性 [#4341](https://github.com/youzan/vant-weapp/issues/4341)
|
||||||
|
- Search: 新增click-input 事件 [#4337](https://github.com/youzan/vant-weapp/issues/4337)
|
||||||
|
|
||||||
### [1.7.1](https://github.com/youzan/vant-weapp/tree/v1.7.1)
|
### [1.7.1](https://github.com/youzan/vant-weapp/tree/v1.7.1)
|
||||||
|
|
||||||
`2021-07-06`
|
`2021-07-06`
|
||||||
|
@ -10,6 +10,13 @@
|
|||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
</demo-block>
|
</demo-block>
|
||||||
|
|
||||||
|
<demo-block title="卡片风格">
|
||||||
|
<van-cell-group inset>
|
||||||
|
<van-cell title="单元格" value="内容" />
|
||||||
|
<van-cell title="单元格" value="内容" label="描述信息" />
|
||||||
|
</van-cell-group>
|
||||||
|
</demo-block>
|
||||||
|
|
||||||
<demo-block title="单元格大小">
|
<demo-block title="单元格大小">
|
||||||
<van-cell-group>
|
<van-cell-group>
|
||||||
<van-cell
|
<van-cell
|
||||||
|
@ -16,6 +16,15 @@ var component_1 = require('../common/component');
|
|||||||
var utils_1 = require('./utils');
|
var utils_1 = require('./utils');
|
||||||
var toast_1 = __importDefault(require('../toast/toast'));
|
var toast_1 = __importDefault(require('../toast/toast'));
|
||||||
var utils_2 = require('../common/utils');
|
var utils_2 = require('../common/utils');
|
||||||
|
var initialMinDate = utils_1.getToday().getTime();
|
||||||
|
var initialMaxDate = (function () {
|
||||||
|
var now = utils_1.getToday();
|
||||||
|
return new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth() + 6,
|
||||||
|
now.getDate()
|
||||||
|
).getTime();
|
||||||
|
})();
|
||||||
component_1.VantComponent({
|
component_1.VantComponent({
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
@ -58,15 +67,11 @@ component_1.VantComponent({
|
|||||||
},
|
},
|
||||||
minDate: {
|
minDate: {
|
||||||
type: null,
|
type: null,
|
||||||
value: Date.now(),
|
value: initialMinDate,
|
||||||
},
|
},
|
||||||
maxDate: {
|
maxDate: {
|
||||||
type: null,
|
type: null,
|
||||||
value: new Date(
|
value: initialMaxDate,
|
||||||
new Date().getFullYear(),
|
|
||||||
new Date().getMonth() + 6,
|
|
||||||
new Date().getDate()
|
|
||||||
).getTime(),
|
|
||||||
},
|
},
|
||||||
position: {
|
position: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -158,24 +163,63 @@ component_1.VantComponent({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getInitialDate: function () {
|
limitDateRange: function (date, minDate, maxDate) {
|
||||||
|
if (minDate === void 0) {
|
||||||
|
minDate = null;
|
||||||
|
}
|
||||||
|
if (maxDate === void 0) {
|
||||||
|
maxDate = null;
|
||||||
|
}
|
||||||
|
minDate = minDate || this.data.minDate;
|
||||||
|
maxDate = maxDate || this.data.maxDate;
|
||||||
|
if (utils_1.compareDay(date, minDate) === -1) {
|
||||||
|
return minDate;
|
||||||
|
}
|
||||||
|
if (utils_1.compareDay(date, maxDate) === 1) {
|
||||||
|
return maxDate;
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
getInitialDate: function (defaultDate) {
|
||||||
|
var _this = this;
|
||||||
|
if (defaultDate === void 0) {
|
||||||
|
defaultDate = null;
|
||||||
|
}
|
||||||
var _a = this.data,
|
var _a = this.data,
|
||||||
type = _a.type,
|
type = _a.type,
|
||||||
defaultDate = _a.defaultDate,
|
minDate = _a.minDate,
|
||||||
minDate = _a.minDate;
|
maxDate = _a.maxDate;
|
||||||
|
var now = utils_1.getToday().getTime();
|
||||||
if (type === 'range') {
|
if (type === 'range') {
|
||||||
|
if (!Array.isArray(defaultDate)) {
|
||||||
|
defaultDate = [];
|
||||||
|
}
|
||||||
var _b = defaultDate || [],
|
var _b = defaultDate || [],
|
||||||
startDay = _b[0],
|
startDay = _b[0],
|
||||||
endDay = _b[1];
|
endDay = _b[1];
|
||||||
return [
|
var start = this.limitDateRange(
|
||||||
startDay || minDate,
|
startDay || now,
|
||||||
endDay || utils_1.getNextDay(new Date(minDate)).getTime(),
|
minDate,
|
||||||
];
|
utils_1.getPrevDay(maxDate).getTime()
|
||||||
|
);
|
||||||
|
var end = this.limitDateRange(
|
||||||
|
endDay || now,
|
||||||
|
utils_1.getNextDay(minDate).getTime()
|
||||||
|
);
|
||||||
|
return [start, end];
|
||||||
}
|
}
|
||||||
if (type === 'multiple') {
|
if (type === 'multiple') {
|
||||||
return defaultDate || [minDate];
|
if (Array.isArray(defaultDate)) {
|
||||||
|
return defaultDate.map(function (date) {
|
||||||
|
return _this.limitDateRange(date);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return [this.limitDateRange(now)];
|
||||||
}
|
}
|
||||||
return defaultDate || minDate;
|
if (!defaultDate || Array.isArray(defaultDate)) {
|
||||||
|
defaultDate = now;
|
||||||
|
}
|
||||||
|
return this.limitDateRange(defaultDate);
|
||||||
},
|
},
|
||||||
scrollIntoView: function () {
|
scrollIntoView: function () {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
Object.defineProperty(exports, '__esModule', { value: true });
|
Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
|
exports.getMonths = exports.getMonthEndDay = exports.copyDates = exports.calcDateNum = exports.getToday = exports.getNextDay = exports.getPrevDay = exports.getDayByOffset = exports.compareDay = exports.compareMonth = exports.formatMonthTitle = exports.ROW_HEIGHT = void 0;
|
||||||
exports.ROW_HEIGHT = 64;
|
exports.ROW_HEIGHT = 64;
|
||||||
function formatMonthTitle(date) {
|
function formatMonthTitle(date) {
|
||||||
if (!(date instanceof Date)) {
|
if (!(date instanceof Date)) {
|
||||||
@ -56,6 +56,12 @@ function getNextDay(date) {
|
|||||||
return getDayByOffset(date, 1);
|
return getDayByOffset(date, 1);
|
||||||
}
|
}
|
||||||
exports.getNextDay = getNextDay;
|
exports.getNextDay = getNextDay;
|
||||||
|
function getToday() {
|
||||||
|
var today = new Date();
|
||||||
|
today.setHours(0, 0, 0, 0);
|
||||||
|
return today;
|
||||||
|
}
|
||||||
|
exports.getToday = getToday;
|
||||||
function calcDateNum(date) {
|
function calcDateNum(date) {
|
||||||
var day1 = new Date(date[0]).getTime();
|
var day1 = new Date(date[0]).getTime();
|
||||||
var day2 = new Date(date[1]).getTime();
|
var day2 = new Date(date[1]).getTime();
|
||||||
|
@ -8,5 +8,6 @@ component_1.VantComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
|
inset: Boolean,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
wx:if="{{ title }}"
|
wx:if="{{ title }}"
|
||||||
class="van-cell-group__title"
|
class="{{ utils.bem('cell-group__title', { inset }) }}"
|
||||||
>
|
>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</view>
|
</view>
|
||||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
|
@ -1 +1 @@
|
|||||||
@import '../common/index.wxss';.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}
|
@import '../common/index.wxss';.van-cell-group--inset{margin:0 16px;margin:var(--cell-group-inset-padding,0 16px);border-radius:8px;border-radius:var(--cell-group-inset-border-radius,8px);overflow:hidden}.van-cell-group__title{padding:16px 16px 8px;padding:var(--cell-group-title-padding,16px 16px 8px);font-size:14px;font-size:var(--cell-group-title-font-size,14px);line-height:16px;line-height:var(--cell-group-title-line-height,16px);color:#969799;color:var(--cell-group-title-color,#969799)}.van-cell-group__title--inset{padding:16px 16px 8px 32px;padding:var(--cell-group-inset-title-padding,16px 16px 8px 32px)}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@vant/weapp",
|
"name": "@vant/weapp",
|
||||||
"version": "1.7.1",
|
"version": "1.7.2",
|
||||||
"author": "youzan",
|
"author": "youzan",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"miniprogram": "lib",
|
"miniprogram": "lib",
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import { VantComponent } from '../common/component';
|
import { VantComponent } from '../common/component';
|
||||||
import {
|
import {
|
||||||
ROW_HEIGHT,
|
ROW_HEIGHT,
|
||||||
|
getPrevDay,
|
||||||
getNextDay,
|
getNextDay,
|
||||||
|
getToday,
|
||||||
compareDay,
|
compareDay,
|
||||||
copyDates,
|
copyDates,
|
||||||
calcDateNum,
|
calcDateNum,
|
||||||
@ -14,6 +16,16 @@ import {
|
|||||||
import Toast from '../toast/toast';
|
import Toast from '../toast/toast';
|
||||||
import { requestAnimationFrame } from '../common/utils';
|
import { requestAnimationFrame } from '../common/utils';
|
||||||
|
|
||||||
|
const initialMinDate = getToday().getTime();
|
||||||
|
const initialMaxDate = (() => {
|
||||||
|
const now = getToday();
|
||||||
|
return new Date(
|
||||||
|
now.getFullYear(),
|
||||||
|
now.getMonth() + 6,
|
||||||
|
now.getDate()
|
||||||
|
).getTime();
|
||||||
|
})();
|
||||||
|
|
||||||
VantComponent({
|
VantComponent({
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
@ -56,15 +68,11 @@ VantComponent({
|
|||||||
},
|
},
|
||||||
minDate: {
|
minDate: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: Date.now(),
|
value: initialMinDate,
|
||||||
},
|
},
|
||||||
maxDate: {
|
maxDate: {
|
||||||
type: Number,
|
type: Number,
|
||||||
value: new Date(
|
value: initialMaxDate,
|
||||||
new Date().getFullYear(),
|
|
||||||
new Date().getMonth() + 6,
|
|
||||||
new Date().getDate()
|
|
||||||
).getTime(),
|
|
||||||
},
|
},
|
||||||
position: {
|
position: {
|
||||||
type: String,
|
type: String,
|
||||||
@ -162,22 +170,58 @@ VantComponent({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialDate() {
|
limitDateRange(
|
||||||
const { type, defaultDate, minDate } = this.data;
|
date: number,
|
||||||
|
minDate: number | null = null,
|
||||||
|
maxDate: number | null = null
|
||||||
|
) {
|
||||||
|
minDate = minDate || (this.data.minDate as number);
|
||||||
|
maxDate = maxDate || (this.data.maxDate as number);
|
||||||
|
if (compareDay(date, minDate) === -1) {
|
||||||
|
return minDate;
|
||||||
|
}
|
||||||
|
if (compareDay(date, maxDate) === 1) {
|
||||||
|
return maxDate;
|
||||||
|
}
|
||||||
|
return date;
|
||||||
|
},
|
||||||
|
|
||||||
|
getInitialDate(defaultDate: number | number[] | null = null) {
|
||||||
|
const { type, minDate, maxDate } = this.data;
|
||||||
|
|
||||||
|
const now = getToday().getTime();
|
||||||
|
|
||||||
if (type === 'range') {
|
if (type === 'range') {
|
||||||
|
if (!Array.isArray(defaultDate)) {
|
||||||
|
defaultDate = [];
|
||||||
|
}
|
||||||
|
|
||||||
const [startDay, endDay] = defaultDate || [];
|
const [startDay, endDay] = defaultDate || [];
|
||||||
return [
|
|
||||||
startDay || minDate,
|
const start = this.limitDateRange(
|
||||||
endDay || getNextDay(new Date(minDate)).getTime(),
|
startDay || now,
|
||||||
];
|
minDate,
|
||||||
|
getPrevDay(maxDate).getTime()
|
||||||
|
);
|
||||||
|
const end = this.limitDateRange(
|
||||||
|
endDay || now,
|
||||||
|
getNextDay(minDate).getTime()
|
||||||
|
);
|
||||||
|
return [start, end];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'multiple') {
|
if (type === 'multiple') {
|
||||||
return defaultDate || [minDate];
|
if (Array.isArray(defaultDate)) {
|
||||||
|
return defaultDate.map((date) => this.limitDateRange(date));
|
||||||
|
}
|
||||||
|
|
||||||
|
return [this.limitDateRange(now)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return defaultDate || minDate;
|
if (!defaultDate || Array.isArray(defaultDate)) {
|
||||||
|
defaultDate = now;
|
||||||
|
}
|
||||||
|
return this.limitDateRange(defaultDate);
|
||||||
},
|
},
|
||||||
|
|
||||||
scrollIntoView() {
|
scrollIntoView() {
|
||||||
|
@ -64,6 +64,12 @@ export function getNextDay(date: Date) {
|
|||||||
return getDayByOffset(date, 1);
|
return getDayByOffset(date, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getToday() {
|
||||||
|
const today = new Date();
|
||||||
|
today.setHours(0, 0, 0, 0);
|
||||||
|
return today;
|
||||||
|
}
|
||||||
|
|
||||||
export function calcDateNum(date: [Date, Date]) {
|
export function calcDateNum(date: [Date, Date]) {
|
||||||
const day1 = new Date(date[0]).getTime();
|
const day1 = new Date(date[0]).getTime();
|
||||||
const day2 = new Date(date[1]).getTime();
|
const day2 = new Date(date[1]).getTime();
|
||||||
|
@ -2,10 +2,21 @@
|
|||||||
@import '../common/style/theme.less';
|
@import '../common/style/theme.less';
|
||||||
|
|
||||||
.van-cell-group {
|
.van-cell-group {
|
||||||
|
&--inset {
|
||||||
|
.theme(margin, '@cell-group-inset-padding');
|
||||||
|
.theme(border-radius, '@cell-group-inset-border-radius');
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
&__title {
|
&__title {
|
||||||
.theme(padding, '@cell-group-title-padding');
|
.theme(padding, '@cell-group-title-padding');
|
||||||
.theme(font-size, '@cell-group-title-font-size');
|
.theme(font-size, '@cell-group-title-font-size');
|
||||||
.theme(line-height, '@cell-group-title-line-height');
|
.theme(line-height, '@cell-group-title-line-height');
|
||||||
.theme(color, '@cell-group-title-color');
|
.theme(color, '@cell-group-title-color');
|
||||||
|
|
||||||
|
&--inset {
|
||||||
|
.theme(padding, '@cell-group-inset-title-padding');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,6 @@ VantComponent({
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
|
inset: Boolean,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
|
<wxs src="../wxs/utils.wxs" module="utils" />
|
||||||
|
|
||||||
<view
|
<view
|
||||||
wx:if="{{ title }}"
|
wx:if="{{ title }}"
|
||||||
class="van-cell-group__title"
|
class="{{ utils.bem('cell-group__title', { inset }) }}"
|
||||||
>
|
>
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</view>
|
</view>
|
||||||
<view class="custom-class van-cell-group {{ border ? 'van-hairline--top-bottom' : '' }}">
|
<view class="custom-class {{ utils.bem('cell-group', { inset }) }} {{ border ? 'van-hairline--top-bottom' : '' }}">
|
||||||
<slot />
|
<slot />
|
||||||
</view>
|
</view>
|
||||||
|
@ -28,6 +28,17 @@
|
|||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 卡片风格
|
||||||
|
|
||||||
|
通过 `CellGroup` 的 `inset` 属性,可以将单元格转换为圆角卡片风格(从 1.7.2 版本开始支持)。
|
||||||
|
|
||||||
|
```html
|
||||||
|
<van-cell-group inset>
|
||||||
|
<van-cell title="单元格" value="内容" />
|
||||||
|
<van-cell title="单元格" value="内容" label="描述信息" />
|
||||||
|
</van-cell-group>
|
||||||
|
```
|
||||||
|
|
||||||
### 单元格大小
|
### 单元格大小
|
||||||
|
|
||||||
通过`size`属性可以控制单元格的大小。
|
通过`size`属性可以控制单元格的大小。
|
||||||
@ -109,10 +120,11 @@
|
|||||||
|
|
||||||
### CellGroup Props
|
### CellGroup Props
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
| ------ | -------------- | --------- | ------ | ---- |
|
| -------------- | ---------------------- | --------- | ------- |
|
||||||
| title | 分组标题 | _string_ | `-` | - |
|
| title | 分组标题 | _string_ | `-` |
|
||||||
| border | 是否显示外边框 | _boolean_ | `true` | - |
|
| inset `v1.7.2` | 是否展示为圆角卡片风格 | _boolean_ | `false` |
|
||||||
|
| border | 是否显示外边框 | _boolean_ | `true` |
|
||||||
|
|
||||||
### CellGroup 外部样式类
|
### CellGroup 外部样式类
|
||||||
|
|
||||||
@ -122,24 +134,24 @@
|
|||||||
|
|
||||||
### Cell Props
|
### Cell Props
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
| --- | --- | --- | --- | --- |
|
| -------------------- | ---------------------------------------------------------- | ------------------ | ------------ |
|
||||||
| icon | 左侧图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - | - |
|
| icon | 左侧图标名称或图片链接,可选值见 [Icon 组件](#/icon) | _string_ | - |
|
||||||
| title | 左侧标题 | _string \| number_ | - |
|
| title | 左侧标题 | _string \| number_ | - |
|
||||||
| title-width | 标题宽度,须包含单位 | _string_ | - | - |
|
| title-width | 标题宽度,须包含单位 | _string_ | - |
|
||||||
| value | 右侧内容 | _string \| number_ | - | - |
|
| value | 右侧内容 | _string \| number_ | - |
|
||||||
| label | 标题下方的描述信息 | _string_ | - | - |
|
| label | 标题下方的描述信息 | _string_ | - |
|
||||||
| size | 单元格大小,可选值为 `large` | _string_ | - | - |
|
| size | 单元格大小,可选值为 `large` | _string_ | - |
|
||||||
| border | 是否显示下边框 | _boolean_ | `true` | - |
|
| border | 是否显示下边框 | _boolean_ | `true` |
|
||||||
| center | 是否使内容垂直居中 | _boolean_ | `false` | - |
|
| center | 是否使内容垂直居中 | _boolean_ | `false` |
|
||||||
| url | 点击后跳转的链接地址 | _string_ | - | - |
|
| url | 点击后跳转的链接地址 | _string_ | - |
|
||||||
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` | - |
|
| link-type | 链接跳转类型,可选值为 `redirectTo` `switchTab` `reLaunch` | _string_ | `navigateTo` |
|
||||||
| clickable | 是否开启点击反馈 | _boolean_ | `false` | - |
|
| clickable | 是否开启点击反馈 | _boolean_ | `false` |
|
||||||
| is-link | 是否展示右侧箭头并开启点击反馈 | _boolean_ | `false` | - |
|
| is-link | 是否展示右侧箭头并开启点击反馈 | _boolean_ | `false` |
|
||||||
| required | 是否显示表单必填星号 | _boolean_ | `false` | - |
|
| required | 是否显示表单必填星号 | _boolean_ | `false` |
|
||||||
| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | _string_ | - | - |
|
| arrow-direction | 箭头方向,可选值为 `left` `up` `down` | _string_ | - |
|
||||||
| use-label-slot | 是否使用 label slot | _boolean_ | `false` | - |
|
| use-label-slot | 是否使用 label slot | _boolean_ | `false` |
|
||||||
| title-style | 标题样式 | _string_ | - | 1.4.0 |
|
| title-style `v1.4.0` | 标题样式 | _string_ | - |
|
||||||
|
|
||||||
### Cell Event
|
### Cell Event
|
||||||
|
|
||||||
|
@ -193,6 +193,9 @@
|
|||||||
@cell-group-title-padding: @padding-md @padding-md @padding-xs;
|
@cell-group-title-padding: @padding-md @padding-md @padding-xs;
|
||||||
@cell-group-title-font-size: @font-size-md;
|
@cell-group-title-font-size: @font-size-md;
|
||||||
@cell-group-title-line-height: 16px;
|
@cell-group-title-line-height: 16px;
|
||||||
|
@cell-group-inset-padding: 0 @padding-md;
|
||||||
|
@cell-group-inset-border-radius: @border-radius-lg;
|
||||||
|
@cell-group-inset-title-padding: @padding-md @padding-md @padding-xs @padding-xl;
|
||||||
|
|
||||||
// Checkbox
|
// Checkbox
|
||||||
@checkbox-size: 20px;
|
@checkbox-size: 20px;
|
||||||
|
@ -145,6 +145,7 @@ Page({
|
|||||||
| bind:focus | 输入框聚焦时触发 | - |
|
| bind:focus | 输入框聚焦时触发 | - |
|
||||||
| bind:blur | 输入框失焦时触发 | - |
|
| bind:blur | 输入框失焦时触发 | - |
|
||||||
| bind:clear | 点击清空控件时触发 | - |
|
| bind:clear | 点击清空控件时触发 | - |
|
||||||
|
| bind:click-input | 点击搜索区域时触发 | - |
|
||||||
|
|
||||||
### Slot
|
### Slot
|
||||||
|
|
||||||
|
@ -83,5 +83,9 @@ VantComponent({
|
|||||||
onClear(event: WechatMiniprogram.CustomEvent) {
|
onClear(event: WechatMiniprogram.CustomEvent) {
|
||||||
this.$emit('clear', event.detail);
|
this.$emit('clear', event.detail);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onClickInput: function (event) {
|
||||||
|
this.$emit('click-input', event.detail);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
bind:change="onChange"
|
bind:change="onChange"
|
||||||
bind:confirm="onSearch"
|
bind:confirm="onSearch"
|
||||||
bind:clear="onClear"
|
bind:clear="onClear"
|
||||||
|
bind:click-input="onClickInput"
|
||||||
>
|
>
|
||||||
<slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" />
|
<slot wx:if="{{ useLeftIconSlot }}" name="left-icon" slot="left-icon" />
|
||||||
<slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" />
|
<slot wx:if="{{ useRightIconSlot }}" name="right-icon" slot="right-icon" />
|
||||||
|
@ -190,7 +190,7 @@ Page({
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// 上传图片
|
// 上传图片
|
||||||
uploadToCloud() {
|
uploadToCloud() {
|
||||||
wx.cloud.init();
|
wx.cloud.init();
|
||||||
const { fileList } = this.data;
|
const { fileList } = this.data;
|
||||||
if (!fileList.length) {
|
if (!fileList.length) {
|
||||||
@ -200,7 +200,7 @@ uploadToCloud() {
|
|||||||
Promise.all(uploadTasks)
|
Promise.all(uploadTasks)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
wx.showToast({ title: '上传成功', icon: 'none' });
|
wx.showToast({ title: '上传成功', icon: 'none' });
|
||||||
const newFileList = data.map(item => { url: item.fileID });
|
const newFileList = data.map(item => ({ url: item.fileID }));
|
||||||
this.setData({ cloudPath: data, fileList: newFileList });
|
this.setData({ cloudPath: data, fileList: newFileList });
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
18
yarn.lock
18
yarn.lock
@ -3215,9 +3215,9 @@
|
|||||||
eslint-visitor-keys "^2.0.0"
|
eslint-visitor-keys "^2.0.0"
|
||||||
|
|
||||||
"@vant/cli@^3.10.3":
|
"@vant/cli@^3.10.3":
|
||||||
version "3.11.0"
|
version "3.11.2"
|
||||||
resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.11.0.tgz#95812fd72f15c844b2a81f974e85901219a599ec"
|
resolved "https://registry.yarnpkg.com/@vant/cli/-/cli-3.11.2.tgz#d6a91160b6d64a8a302bebff1858ef8ea3671b0c"
|
||||||
integrity sha512-MERBUKZlJvbQT8JJVKkoxL0z532uXHnT5lfs9puszi9uvxLV042PuTm2eF/CAz5mwV5jEZyTapMTZBpmOfLuUA==
|
integrity sha512-8sd61UqKHBsCkc3K1wrymuo9f6JxRFfKbX6nq5rlexygZLmoydKgXL8fpB9w3uhriiJJLt3JKNm6Q8k49IjyeA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/core" "^7.14.5"
|
"@babel/core" "^7.14.5"
|
||||||
"@babel/preset-env" "^7.14.5"
|
"@babel/preset-env" "^7.14.5"
|
||||||
@ -3292,9 +3292,9 @@
|
|||||||
eslint-plugin-vue "^7.1.0"
|
eslint-plugin-vue "^7.1.0"
|
||||||
|
|
||||||
"@vant/icons@^1.6.0":
|
"@vant/icons@^1.6.0":
|
||||||
version "1.6.0"
|
version "1.7.0"
|
||||||
resolved "https://registry.npmjs.org/@vant/icons/-/icons-1.6.0.tgz#3db7eb7f963f51a2a08676720d5af9c4c3512feb"
|
resolved "https://registry.yarnpkg.com/@vant/icons/-/icons-1.7.0.tgz#02d427532a8142c35db159da9c364fe6890c3ac9"
|
||||||
integrity sha512-4Hvq4tl4grCOJLZ0e8ZaivBV8xOcmTPmTT8BDkTrEIKqnDowRFDdsXxcHECzWmbmMx+CYGdngvd2Cq8YR9DfKA==
|
integrity sha512-sqKvtYcSgSd6+AU1nBPaZARn2Nzf8hi0ErLhfXVR6f+Y7R0gojGZVoxuB83yUI6+0LwbitW5IfN3E6qzEsu21Q==
|
||||||
|
|
||||||
"@vant/markdown-loader@^4.1.0":
|
"@vant/markdown-loader@^4.1.0":
|
||||||
version "4.1.0"
|
version "4.1.0"
|
||||||
@ -11065,9 +11065,9 @@ minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.5:
|
|||||||
integrity sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=
|
integrity sha1-Z9ZgFLZqaoqqDAg8X9WN9OTpdgI=
|
||||||
|
|
||||||
miniprogram-api-typings@^3.1.6:
|
miniprogram-api-typings@^3.1.6:
|
||||||
version "3.3.1"
|
version "3.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-3.3.1.tgz#1cc58437873fe01c1b4f382aa7630bd73d848c42"
|
resolved "https://registry.yarnpkg.com/miniprogram-api-typings/-/miniprogram-api-typings-3.4.1.tgz#17cef4c184d32b2e12e2deb5559d1c01c84fa891"
|
||||||
integrity sha512-3MTHaLgcuaLlMiEIVn3OdzJjLKgZfkpV/KrwxUYIL/+4b4BM6TAFYcwsXmQH7edOG9AUwU7pkQESpzE0ZjpPUQ==
|
integrity sha512-kGUJ4zLgwzGyhtCOR2DTz8LTPkKJVek9OqspzGoMVcrmAKV76WqJ6sEOwJoQ1kO/VlTuXEKCu9+ZXB7hFKLcmw==
|
||||||
|
|
||||||
miniprogram-ci@^1.0.27:
|
miniprogram-ci@^1.0.27:
|
||||||
version "1.2.3"
|
version "1.2.3"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user