-
![]()
+
![]()
@@ -33,7 +36,9 @@ export default {
body {
margin: 0;
color: #323233;
- font-family: 'PingFang SC', Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, Arial, sans-serif;
+ font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica,
+ Segoe UI, Arial, Roboto, 'PingFang SC', 'Hiragino Sans GB',
+ 'Microsoft Yahei', sans-serif;
line-height: 1;
background-color: #f7f8fa;
-webkit-font-smoothing: antialiased;
@@ -57,9 +62,9 @@ body {
width: 100%;
height: 100%;
text-align: center;
- background-color: rgba(255, 255, 255, .95);
+ background-color: rgba(255, 255, 255, 0.95);
opacity: 0;
- transition: .3s;
+ transition: 0.3s;
&:hover {
opacity: 1;
diff --git a/example/app.wxss b/example/app.wxss
index 2e1f0b1f6..850563464 100644
--- a/example/app.wxss
+++ b/example/app.wxss
@@ -4,7 +4,6 @@ page {
padding: 0 0 100rpx;
color: #323233;
font-size: 16px;
- font-family: 'PingFang SC', Helvetica, Arial, sans-serif;
background: #f7f8fa;
-webkit-font-smoothing: antialiased;
}
diff --git a/packages/common/index.less b/packages/common/index.less
index 88b0f7082..c194c586f 100644
--- a/packages/common/index.less
+++ b/packages/common/index.less
@@ -2,7 +2,8 @@
* Entry of basic styles
*/
-@import "./style/var.less";
-@import "./style/ellipsis.less";
-@import "./style/clearfix.less";
-@import "./style/hairline.less";
+@import './style/var.less';
+@import './style/normalize.less';
+@import './style/ellipsis.less';
+@import './style/clearfix.less';
+@import './style/hairline.less';
diff --git a/packages/common/style/normalize.less b/packages/common/style/normalize.less
new file mode 100644
index 000000000..8b688eb8e
--- /dev/null
+++ b/packages/common/style/normalize.less
@@ -0,0 +1,5 @@
+@import './var';
+
+page {
+ font-family: @base-font-family;
+}
diff --git a/packages/common/style/var.less b/packages/common/style/var.less
index a1786a659..721cad9ff 100644
--- a/packages/common/style/var.less
+++ b/packages/common/style/var.less
@@ -23,8 +23,8 @@
// Component Colors
@text-color: @gray-8;
@active-color: @gray-2;
-@active-opacity: .7;
-@disabled-opacity: .5;
+@active-opacity: 0.7;
+@disabled-opacity: 0.5;
@background-color: @gray-1;
@background-color-light: #fafafa;
@@ -42,11 +42,15 @@
@font-size-md: 14px;
@font-size-lg: 16px;
@font-weight-bold: 500;
-@price-integer-font-family: Avenir-Heavy, PingFang SC, Helvetica Neue, Arial, sans-serif;
+@base-font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue',
+ Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', 'Hiragino Sans GB',
+ 'Microsoft Yahei', sans-serif;
+@price-integer-font-family: Avenir-Heavy, PingFang SC, Helvetica Neue, Arial,
+ sans-serif;
// Animation
-@animation-duration-base: .3s;
-@animation-duration-fast: .2s;
+@animation-duration-base: 0.3s;
+@animation-duration-fast: 0.2s;
// Border
@border-color: @gray-3;
@@ -186,7 +190,7 @@
// Checkbox
@checkbox-size: 20px;
@checkbox-border-color: @gray-5;
-@checkbox-transition-duration: .2s;
+@checkbox-transition-duration: 0.2s;
@checkbox-label-margin: 10px;
@checkbox-label-color: @text-color;
@checkbox-checked-icon-color: @blue;
@@ -198,7 +202,7 @@
@circle-text-color: @text-color;
// Collapse
-@collapse-item-transition-duration: .3s;
+@collapse-item-transition-duration: 0.3s;
@collapse-item-content-padding: 15px;
@collapse-item-content-font-size: 13px;
@collapse-item-content-line-height: 1.5;
@@ -272,7 +276,7 @@
@info-background-color: @red;
@info-dot-color: @red;
@info-dot-size: 8px;
-@info-font-family: PingFang SC, Helvetica Neue, Arial, sans-serif;
+@info-font-family: @price-integer-font-family;
// Loading
@loading-text-color: @gray-6;
@@ -280,7 +284,7 @@
@loading-text-line-height: 20px;
@loading-spinner-color: @gray-5;
@loading-spinner-size: 30px;
-@loading-spinner-animation-duration: .8s;
+@loading-spinner-animation-duration: 0.8s;
// NavBar
@nav-bar-height: 44px;
@@ -329,8 +333,8 @@
@picker-option-font-size: @font-size-lg;
@picker-option-text-color: @black;
@picker-loading-icon-color: @blue;
-@picker-loading-mask-color: rgba(255, 255, 255, .9);
-@picker-option-disabled-opacity: .3;
+@picker-loading-mask-color: rgba(255, 255, 255, 0.9);
+@picker-option-disabled-opacity: 0.3;
@picker-option-selected-text-color: @text-color;
// Popup
@@ -354,7 +358,7 @@
// Radio
@radio-size: 20px;
@radio-border-color: @gray-5;
-@radio-transition-duration: .2s;
+@radio-transition-duration: 0.2s;
@radio-label-margin: 10px;
@radio-label-color: @text-color;
@radio-checked-icon-color: @blue;
@@ -372,12 +376,13 @@
@switch-node-size: 1em;
@switch-node-z-index: 1;
@switch-node-background-color: @white;
-@switch-node-box-shadow: 0 3px 1px 0 rgba(0, 0, 0, .05), 0 2px 2px 0 rgba(0, 0, 0, .1), 0 3px 3px 0 rgba(0, 0, 0, .05);
+@switch-node-box-shadow: 0 3px 1px 0 rgba(0, 0, 0, 0.05),
+ 0 2px 2px 0 rgba(0, 0, 0, 0.1), 0 3px 3px 0 rgba(0, 0, 0, 0.05);
@switch-background-color: @white;
@switch-on-background-color: @blue;
-@switch-transition-duration: .3s;
-@switch-disabled-opacity: .4;
-@switch-border: 1px solid rgba(0, 0, 0, .1);
+@switch-transition-duration: 0.3s;
+@switch-disabled-opacity: 0.4;
+@switch-border: 1px solid rgba(0, 0, 0, 0.1);
// Search
@search-background-color: @gray-1;
@@ -415,7 +420,7 @@
@slider-button-height: 24px;
@slider-button-border-radius: 50%;
@slider-button-background-color: @white;
-@slider-button-box-shadow: 0 1px 2px rgba(0, 0, 0, .5);
+@slider-button-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
// Step
@step-text-color: @gray-6;
@@ -494,12 +499,12 @@
@tabs-bottom-bar-color: @tabs-default-color;
// Tag
-@tag-padding: .2em .5em;
+@tag-padding: 0.2em 0.5em;
@tag-font-size: @font-size-xs;
@tag-medium-font-size: @font-size-sm;
@tag-large-font-size: @font-size-md;
@tag-text-color: @white;
-@tag-border-radius: .2em;
+@tag-border-radius: 0.2em;
@tag-round-border-radius: @border-radius-max;
@tag-dander-color: @red;
@tag-primary-color: @blue;
@@ -514,7 +519,7 @@
@toast-text-color: @white;
@toast-line-height: 20px;
@toast-border-radius: @border-radius-md;
-@toast-background-color: rgba(@text-color, .88);
+@toast-background-color: rgba(@text-color, 0.88);
@toast-icon-size: 48px;
@toast-text-min-width: 96px;
@toast-text-padding: @padding-xs @padding-sm;
From 44fc8b065c62302de8f95052d1f366c3843b1d12 Mon Sep 17 00:00:00 2001
From: chenjiahan
Date: Fri, 24 Apr 2020 22:50:56 +0800
Subject: [PATCH 0249/1249] chore: prettier evenything
---
build/compiler.js | 8 +-
build/dev.js | 4 +-
build/webpack.doc.dev.js | 50 +++---
build/webpack.doc.prd.js | 4 +-
docs/markdown/changelog.md | 50 +++---
docs/markdown/custom-style.md | 4 +-
docs/markdown/intro.md | 10 +-
docs/markdown/quickstart.md | 1 -
docs/markdown/theme.md | 15 +-
docs/src/App.vue | 23 ++-
docs/src/Preview.vue | 6 +-
docs/src/doc.config.js | 38 ++---
docs/src/index.js | 8 +-
docs/src/preview.js | 2 +-
docs/src/router.js | 30 ++--
package.json | 2 +-
packages/action-sheet/README.md | 85 +++++------
packages/action-sheet/index.ts | 20 +--
packages/area/README.md | 57 +++----
packages/area/index.ts | 41 ++---
packages/button/README.md | 68 +++++----
packages/button/index.ts | 18 +--
packages/calendar/README.md | 114 +++++++-------
packages/calendar/components/header/index.ts | 8 +-
packages/calendar/components/month/index.ts | 28 ++--
packages/calendar/index.ts | 67 ++++----
packages/calendar/utils.ts | 2 +-
packages/card/README.md | 66 ++++----
packages/card/index.ts | 16 +-
packages/cell-group/index.json | 2 +-
packages/cell-group/index.ts | 6 +-
packages/cell/README.md | 74 ++++-----
packages/cell/index.json | 2 +-
packages/cell/index.less | 2 +-
packages/cell/index.ts | 10 +-
packages/checkbox-group/index.ts | 12 +-
packages/checkbox/README.md | 100 ++++++------
packages/checkbox/index.ts | 22 ++-
packages/circle/README.md | 36 ++---
packages/circle/index.ts | 28 ++--
packages/col/README.md | 21 ++-
packages/col/index.less | 8 +-
packages/col/index.ts | 12 +-
packages/collapse-item/index.ts | 23 +--
packages/collapse/README.md | 83 +++++-----
packages/collapse/index.ts | 16 +-
packages/common/README.md | 14 +-
packages/common/component.ts | 17 ++-
packages/common/style/hairline.less | 2 +-
packages/count-down/README.md | 64 ++++----
packages/count-down/index.ts | 16 +-
packages/count-down/utils.ts | 2 +-
packages/datetime-picker/README.md | 102 ++++++-------
packages/datetime-picker/index.ts | 68 ++++-----
packages/definitions/index.ts | 9 +-
packages/dialog/README.md | 152 ++++++++++---------
packages/dialog/dialog.ts | 28 ++--
packages/dialog/index.ts | 40 ++---
packages/divider/README.md | 30 ++--
packages/divider/index.json | 2 +-
packages/divider/index.less | 2 +-
packages/divider/index.ts | 18 +--
packages/dropdown-item/index.ts | 22 +--
packages/dropdown-menu/README.md | 38 ++---
packages/dropdown-menu/index.json | 2 +-
packages/dropdown-menu/index.less | 4 +-
packages/dropdown-menu/index.ts | 33 ++--
packages/field/README.md | 113 +++++++-------
packages/field/index.json | 2 +-
packages/field/index.ts | 18 +--
packages/field/props.ts | 24 +--
packages/goods-action-button/index.ts | 10 +-
packages/goods-action-icon/index.ts | 6 +-
packages/goods-action/README.md | 122 +++++++--------
packages/goods-action/index.ts | 6 +-
packages/grid-item/index.ts | 8 +-
packages/grid/README.md | 58 +++----
packages/grid/index.ts | 20 +--
packages/icon/README.md | 30 ++--
packages/icon/index.ts | 12 +-
packages/image/README.md | 95 ++++++------
packages/image/index.ts | 26 ++--
packages/index-anchor/index.ts | 12 +-
packages/index-bar/README.md | 32 ++--
packages/index-bar/index.ts | 58 +++----
packages/info/index.ts | 4 +-
packages/loading/README.md | 28 ++--
packages/loading/index.json | 2 +-
packages/loading/index.ts | 4 +-
packages/mixins/basic.ts | 13 +-
packages/mixins/button.ts | 4 +-
packages/mixins/link.ts | 8 +-
packages/mixins/open-type.ts | 4 +-
packages/mixins/page-scroll.ts | 4 +-
packages/mixins/touch.ts | 7 +-
packages/mixins/transition.ts | 28 ++--
packages/nav-bar/README.md | 45 +++---
packages/nav-bar/index.ts | 20 +--
packages/notice-bar/README.md | 44 +++---
packages/notice-bar/index.json | 2 +-
packages/notice-bar/index.ts | 36 ++---
packages/notify/README.md | 34 ++---
packages/notify/index.ts | 17 +--
packages/notify/notify.ts | 4 +-
packages/overlay/README.md | 37 +++--
packages/overlay/index.ts | 11 +-
packages/panel/README.md | 30 ++--
packages/panel/index.ts | 4 +-
packages/picker-column/index.json | 2 +-
packages/picker-column/index.ts | 18 +--
packages/picker/README.md | 73 ++++-----
packages/picker/index.less | 8 +-
packages/picker/index.ts | 29 ++--
packages/picker/shared.ts | 10 +-
packages/popup/README.md | 56 +++----
packages/popup/index.ts | 28 ++--
packages/progress/README.md | 37 ++---
packages/progress/index.ts | 12 +-
packages/radio-group/index.ts | 16 +-
packages/radio/README.md | 86 +++++------
packages/radio/index.ts | 12 +-
packages/rate/README.md | 69 ++++-----
packages/rate/index.ts | 26 ++--
packages/row/index.less | 2 +-
packages/row/index.ts | 12 +-
packages/search/README.md | 84 +++++-----
packages/search/index.ts | 16 +-
packages/sidebar-item/index.ts | 11 +-
packages/sidebar/README.md | 8 +-
packages/sidebar/index.ts | 10 +-
packages/skeleton/README.md | 33 ++--
packages/skeleton/index.json | 2 +-
packages/skeleton/index.less | 5 +-
packages/skeleton/index.ts | 16 +-
packages/slider/README.md | 56 +++----
packages/slider/index.ts | 39 ++---
packages/stepper/README.md | 42 ++---
packages/stepper/index.json | 2 +-
packages/stepper/index.ts | 30 ++--
packages/steps/README.md | 47 +++---
packages/steps/index.ts | 12 +-
packages/sticky/README.md | 20 +--
packages/sticky/index.ts | 30 ++--
packages/submit-bar/README.md | 56 ++++---
packages/submit-bar/index.ts | 30 ++--
packages/swipe-cell/README.md | 86 ++++++-----
packages/switch/README.md | 49 +++---
packages/switch/index.ts | 14 +-
packages/tab/README.md | 86 +++++------
packages/tab/index.json | 2 +-
packages/tab/index.ts | 20 +--
packages/tabbar-item/index.ts | 8 +-
packages/tabbar/README.md | 67 ++++----
packages/tabbar/index.ts | 22 +--
packages/tabs/index.less | 4 +-
packages/tabs/index.ts | 64 ++++----
packages/tag/README.md | 26 ++--
packages/tag/index.ts | 8 +-
packages/toast/README.md | 46 +++---
packages/toast/index.ts | 14 +-
packages/toast/toast.ts | 18 ++-
packages/transition/README.md | 54 +++----
packages/transition/index.json | 2 +-
packages/transition/index.ts | 4 +-
packages/tree-select/README.md | 57 ++++---
packages/tree-select/index.ts | 18 +--
packages/uploader/README.md | 88 +++++------
packages/uploader/index.ts | 62 ++++----
packages/uploader/shared.ts | 16 +-
packages/uploader/utils.ts | 10 +-
yarn.lock | 8 +-
171 files changed, 2454 insertions(+), 2453 deletions(-)
diff --git a/build/compiler.js b/build/compiler.js
index 5af48f08b..5678e3344 100644
--- a/build/compiler.js
+++ b/build/compiler.js
@@ -20,7 +20,7 @@ const exampleDir = path.resolve(__dirname, '../example/dist');
const baseCssPath = path.resolve(__dirname, '../packages/common/index.wxss');
-const lessCompiler = dist =>
+const lessCompiler = (dist) =>
function compileLess() {
return gulp
.src(`${src}/**/*.less`)
@@ -55,21 +55,21 @@ const copier = (dist, ext) =>
return gulp.src(`${src}/**/*.${ext}`).pipe(gulp.dest(dist));
};
-const staticCopier = dist =>
+const staticCopier = (dist) =>
gulp.parallel(
copier(dist, 'wxml'),
copier(dist, 'wxs'),
copier(dist, 'json')
);
-const cleaner = path =>
+const cleaner = (path) =>
function clean() {
return exec(`npx rimraf ${path}`);
};
const tasks = [
['buildEs', esDir, esConfig],
- ['buildLib', libDir, libConfig]
+ ['buildLib', libDir, libConfig],
].reduce((prev, [name, ...args]) => {
prev[name] = gulp.series(
cleaner(...args),
diff --git a/build/dev.js b/build/dev.js
index 720f0350f..813669c9b 100644
--- a/build/dev.js
+++ b/build/dev.js
@@ -8,5 +8,5 @@ const gulpConfig = path.resolve(__dirname, './compiler.js');
serve({}, { config });
const p = exec(`npx gulp -f ${gulpConfig} buildExample --color`);
-p.stdout.on('data', stdout => console.info(stdout));
-p.stderr.on('data', stderr => console.info(stderr));
+p.stdout.on('data', (stdout) => console.info(stdout));
+p.stderr.on('data', (stderr) => console.info(stderr));
diff --git a/build/webpack.doc.dev.js b/build/webpack.doc.dev.js
index f5a8c7e96..1370fdedd 100644
--- a/build/webpack.doc.dev.js
+++ b/build/webpack.doc.dev.js
@@ -7,30 +7,30 @@ module.exports = {
mode: 'development',
entry: {
'vant-docs': './docs/src/index.js',
- 'vant-preview': './docs/src/preview.js'
+ 'vant-preview': './docs/src/preview.js',
},
output: {
path: path.join(__dirname, '../docs/dist'),
publicPath: '/',
- chunkFilename: 'async_[name].js'
+ chunkFilename: 'async_[name].js',
},
stats: {
modules: false,
- children: false
+ children: false,
},
serve: {
open: true,
host: '0.0.0.0',
devMiddleware: {
- logLevel: 'warn'
+ logLevel: 'warn',
},
hotClient: {
logLevel: 'warn',
- allEntries: true
- }
+ allEntries: true,
+ },
},
resolve: {
- extensions: ['.js', '.vue', '.css']
+ extensions: ['.js', '.vue', '.css'],
},
module: {
rules: [
@@ -41,34 +41,26 @@ module.exports = {
loader: 'vue-loader',
options: {
compilerOptions: {
- preserveWhitespace: false
- }
- }
- }
- ]
+ preserveWhitespace: false,
+ },
+ },
+ },
+ ],
},
{
test: /\.js$/,
exclude: /node_modules/,
- use: 'babel-loader'
+ use: 'babel-loader',
},
{
test: /\.(css|less)$/,
- use: [
- 'style-loader',
- 'css-loader',
- 'postcss-loader',
- 'less-loader'
- ]
+ use: ['style-loader', 'css-loader', 'postcss-loader', 'less-loader'],
},
{
test: /\.md$/,
- use: [
- 'vue-loader',
- '@vant/markdown-loader'
- ]
- }
- ]
+ use: ['vue-loader', '@vant/markdown-loader'],
+ },
+ ],
},
plugins: [
new VueLoaderPlugin(),
@@ -77,13 +69,13 @@ module.exports = {
chunks: ['vant-docs'],
template: 'docs/src/index.tpl',
filename: 'index.html',
- inject: true
+ inject: true,
}),
new HtmlWebpackPlugin({
chunks: ['vant-preview'],
template: 'docs/src/index.tpl',
filename: 'preview.html',
- inject: true
- })
- ]
+ inject: true,
+ }),
+ ],
};
diff --git a/build/webpack.doc.prd.js b/build/webpack.doc.prd.js
index 7269fced3..ae625e806 100644
--- a/build/webpack.doc.prd.js
+++ b/build/webpack.doc.prd.js
@@ -9,6 +9,6 @@ module.exports = Object.assign(config, {
path: path.join(__dirname, '../docs/dist'),
publicPath: 'https://b.yzcdn.cn/vant-weapp/',
filename: '[name].[hash:8].js',
- chunkFilename: 'async_[name].[chunkhash:8].js'
- }
+ chunkFilename: 'async_[name].[chunkhash:8].js',
+ },
});
diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md
index 348826cd9..1685f27be 100644
--- a/docs/markdown/changelog.md
+++ b/docs/markdown/changelog.md
@@ -1,7 +1,7 @@
# 更新日志
-
### [v1.2.2](https://github.com/youzan/vant-weapp/tree/v1.2.2)
+
`2020-04-21`
**Features**
@@ -16,6 +16,7 @@
- Field: 避免设置 showClear 为 undefined [\#3012](https://github.com/youzan/vant-weapp/pull/3012)
### [v1.2.1](https://github.com/youzan/vant-weapp/tree/v1.2.1)
+
`2020-04-12`
**Features**
@@ -30,6 +31,7 @@
- Field: 修复 autosize 属性 设置 max-height 不生效 [\#3007](https://github.com/youzan/vant-weapp/pull/3007)
### [v1.2.0](https://github.com/youzan/vant-weapp/tree/v1.2.0)
+
`2020-04-04`
**Features**
@@ -50,20 +52,21 @@
- Tab: 修复 type 为 card 时 color 对边框无效 [\#2941](https://github.com/youzan/vant-weapp/pull/2941)
### [v1.1.0](https://github.com/youzan/vant-weapp/tree/v1.1.0)
+
`2020-03-21`
**Features**
-- 新增 Calendar 日历组件 [\#2894](https://github.com/youzan/vant-weapp/pull/2894)
+- 新增 Calendar 日历组件 [\#2894](https://github.com/youzan/vant-weapp/pull/2894)
- Grid: 新增外部样式类 custom-class、content-class、icon-class、text-class [\#2882](https://github.com/youzan/vant-weapp/pull/2882)
- Steps: 新增 click 事件 [\#2874](https://github.com/youzan/vant-weapp/pull/2874)
- SideBar: 新增 title 插槽 [\#2873](https://github.com/youzan/vant-weapp/pull/2873)
- Uploader: 新增 upload-icon 属性 [\#2869](https://github.com/youzan/vant-weapp/pull/2869)
- Uploader: 新增 show-upload 属性 [\#2868](https://github.com/youzan/vant-weapp/pull/2868)
-- Uploader: 更新样式、调整事件触发顺序与vant一致 [\#2886](https://github.com/youzan/vant-weapp/pull/2886)
+- Uploader: 更新样式、调整事件触发顺序与 vant 一致 [\#2886](https://github.com/youzan/vant-weapp/pull/2886)
- Field: 新增 show-word-limit 属性 [\#2856](https://github.com/youzan/vant-weapp/pull/2856)
- Field: autosize 属性支持传入对象,指定 maxHeight 与 minHeight [\#2856](https://github.com/youzan/vant-weapp/pull/2856)
-- Field: 新增若干CSS变量 [\#2856](https://github.com/youzan/vant-weapp/pull/2856)
+- Field: 新增若干 CSS 变量 [\#2856](https://github.com/youzan/vant-weapp/pull/2856)
**Bug Fixes**
@@ -71,6 +74,7 @@
- Button: 修复 disabled 属性对原生事件无效 [\#2878](https://github.com/youzan/vant-weapp/pull/2878)
### [v1.0.7](https://github.com/youzan/vant-weapp/tree/v1.0.7)
+
`2020-03-04`
**Features**
@@ -84,19 +88,20 @@
- Tab: 修复内容项高度不同时粘性布局异常 [\#2817](https://github.com/youzan/vant-weapp/pull/2817)
- Picker: 修复未选中项样式未置灰 [\#2816](https://github.com/youzan/vant-weapp/pull/2816)
-- GoodsActionButton: 修复仅使用一个button时样式异常 [\#2808](https://github.com/youzan/vant-weapp/pull/2808)
+- GoodsActionButton: 修复仅使用一个 button 时样式异常 [\#2808](https://github.com/youzan/vant-weapp/pull/2808)
- Radio: `name`类型与`value`统一 [\#2801](https://github.com/youzan/vant-weapp/pull/2801)
- Uploader: 修复文档错误 [\#2777](https://github.com/youzan/vant-weapp/pull/2777)
### [v1.0.6](https://github.com/youzan/vant-weapp/tree/v1.0.6)
+
`2020-02-24`
**Features**
-- GoodsActionButton: 新增默认slot [\#2779](https://github.com/youzan/vant-weapp/pull/2779)
+- GoodsActionButton: 新增默认 slot [\#2779](https://github.com/youzan/vant-weapp/pull/2779)
- SubmitBar: 更新圆角样式 [\#2755](https://github.com/youzan/vant-weapp/pull/2755)
- Card: 更新样式 [\#2754](https://github.com/youzan/vant-weapp/pull/2754)
-- 优化relation部分代码 [\#2760](https://github.com/youzan/vant-weapp/pull/2760)
+- 优化 relation 部分代码 [\#2760](https://github.com/youzan/vant-weapp/pull/2760)
**Bug Fixes**
@@ -108,15 +113,16 @@
- Radio: 修复`label-disabled`文档错误 [\#2763](https://github.com/youzan/vant-weapp/pull/2763)
### [v1.0.5](https://github.com/youzan/vant-weapp/tree/v1.0.5)
+
`2020-02-07`
**Features**
- ActionSheet: actions 支持更多 openType [\#2715](https://github.com/youzan/vant-weapp/pull/2715)
- Uploader: 新增开始`disabled`时的组件样式 [\#2720](https://github.com/youzan/vant-weapp/pull/2720)
-- Icon: 调整示例小程序页面与vant对齐 [\#2728](https://github.com/youzan/vant-weapp/pull/2728)
-- 示例小程序首页与vant对齐 [\#2729](https://github.com/youzan/vant-weapp/pull/2729)
-- 完善快速上手文档,增加npm构建说明 [\#2726](https://github.com/youzan/vant-weapp/pull/2726)
+- Icon: 调整示例小程序页面与 vant 对齐 [\#2728](https://github.com/youzan/vant-weapp/pull/2728)
+- 示例小程序首页与 vant 对齐 [\#2729](https://github.com/youzan/vant-weapp/pull/2729)
+- 完善快速上手文档,增加 npm 构建说明 [\#2726](https://github.com/youzan/vant-weapp/pull/2726)
**Bug Fixes**
@@ -127,6 +133,7 @@
- TreeSelect: 修正文档示例代码标签闭合错误 [\#2710](https://github.com/youzan/vant-weapp/pull/2710)
### [v1.0.4](https://github.com/youzan/vant-weapp/tree/v1.0.4)
+
`2020-01-21`
**Features**
@@ -144,11 +151,12 @@
- 升级依赖版本以避免安全警告 [\#2680](https://github.com/youzan/vant-weapp/pull/2680)
### [v1.0.3](https://github.com/youzan/vant-weapp/tree/v1.0.3)
+
`2020-01-09`
**Features**
-- npm包默认输出es5版本代码 [\#2639](https://github.com/youzan/vant-weapp/pull/2639)
+- npm 包默认输出 es5 版本代码 [\#2639](https://github.com/youzan/vant-weapp/pull/2639)
- Steps: 新增外部样式类 desc-class [\#2630](https://github.com/youzan/vant-weapp/pull/2630)
**Bug Fixes**
@@ -157,23 +165,26 @@
- NavBar: 修复返回图标未居中的问题 [\#2633](https://github.com/youzan/vant-weapp/pull/2633)
### [v1.0.2](https://github.com/youzan/vant-weapp/tree/v1.0.2)
+
`2019-12-31`
**Features**
-- Skeleton: 新增外部样式类`row-class``avatar-class``title-class` [\#2612](https://github.com/youzan/vant-weapp/pull/2612)
+- Skeleton: 新增外部样式类` row-class``avatar-class``title-class ` [\#2612](https://github.com/youzan/vant-weapp/pull/2612)
- SwipeCell: 支持动态修改`width`属性 [\#2607](https://github.com/youzan/vant-weapp/pull/2607)
-- Uploader: 新增`camera``compressed``maxDuration`属性 [\#2584](https://github.com/youzan/vant-weapp/pull/2584)
+- Uploader: 新增` camera``compressed``maxDuration `属性 [\#2584](https://github.com/youzan/vant-weapp/pull/2584)
**Improvements**
+
- Tab: 优化弹性滚动效果 [\#2606](https://github.com/youzan/vant-weapp/pull/2606)
**Bug Fixes**
-- IndexBar: 修复字母未全部定义时click事件报错 [\#2605](https://github.com/youzan/vant-weapp/pull/2605)
+- IndexBar: 修复字母未全部定义时 click 事件报错 [\#2605](https://github.com/youzan/vant-weapp/pull/2605)
- Field: 修复点击清除图标后下一次点击无效 [\#2602](https://github.com/youzan/vant-weapp/pull/2602)
### [v1.0.1](https://github.com/youzan/vant-weapp/tree/v1.0.1)
+
`2019-12-23`
**Features**
@@ -195,6 +206,7 @@
- Uploader: 修复 capture 属性不生效 [\#2551](https://github.com/youzan/vant-weapp/pull/2551)
### [v1.0.0](https://github.com/youzan/vant-weapp/tree/v1.0.0)
+
`2019-12-11`
#### 主要变动
@@ -203,7 +215,7 @@
- 增加十一个新组件
- 增加数十个 API
- 所有组件支持通过`CSS自定义属性`自定义样式
-- 使用`env()`重构iOS安全区域适配
+- 使用`env()`重构 iOS 安全区域适配
- 调整部分 API 命名,废除少量 API
#### 新组件
@@ -230,9 +242,9 @@
微信小程序的环境是非常特殊的。不具有动态加载代码的机制,同时微信又限制了代码的主包大小和总大小。传统的基于预设的样式定制过于臃肿,不再适合微信小程序的环境。
-微信小程序自定义组件的组件模型相当于一个简化版的 [Shadow DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom?hl=zh-CN),幸运的是,小程序也支持了 [CSS自定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 的特性。最终,我们基于CSS自定义属性设计了样式定制的方案,开发者使用灵活、方便,组件维护也更简单。
+微信小程序自定义组件的组件模型相当于一个简化版的 [Shadow DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom?hl=zh-CN),幸运的是,小程序也支持了 [CSS 自定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 的特性。最终,我们基于 CSS 自定义属性设计了样式定制的方案,开发者使用灵活、方便,组件维护也更简单。
-从 1.0 版本开始,Vant Weapp 中的所有组件都支持通过 [CSS组定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 进行样式定制,具体使用姿势可查看[相关文档](https://youzan.github.io/vant-weapp/#/theme)
+从 1.0 版本开始,Vant Weapp 中的所有组件都支持通过 [CSS 组定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 进行样式定制,具体使用姿势可查看[相关文档](https://youzan.github.io/vant-weapp/#/theme)

@@ -263,7 +275,7 @@
- 去除`transitionend`事件,新增 6 个事件
-----
+---
#### 新特性
@@ -404,7 +416,7 @@
- 新增`input-width`属性
- 新增`button-size`属性
- 新增`decimalLength`属性
-- 新增 disablePlus、disableMinus属性
+- 新增 disablePlus、disableMinus 属性
##### Steps
diff --git a/docs/markdown/custom-style.md b/docs/markdown/custom-style.md
index 6f24af590..a9bfb33b5 100644
--- a/docs/markdown/custom-style.md
+++ b/docs/markdown/custom-style.md
@@ -35,8 +35,8 @@ Vant Weapp 的所有组件都开启了`addGlobalClass: true`以接受外部样
```js
Component({
options: {
- styleIsolation: 'shared'
- }
+ styleIsolation: 'shared',
+ },
});
```
diff --git a/docs/markdown/intro.md b/docs/markdown/intro.md
index 514fd3b85..288255ae9 100644
--- a/docs/markdown/intro.md
+++ b/docs/markdown/intro.md
@@ -40,11 +40,11 @@ Vant Weapp 是移动端 Vue 组件库 [Vant](https://github.com/youzan/vant) 的
### 链接
-* [意见反馈](https://github.com/youzan/vant-weapp/issues)
-* [加入我们](https://job.youzan.com)
-* [更新日志](#/changelog)
-* [Vue 组件库](https://github.com/youzan/vant)
-* [React 组件库](https://www.youzanyun.com/zanui/zent)
+- [意见反馈](https://github.com/youzan/vant-weapp/issues)
+- [加入我们](https://job.youzan.com)
+- [更新日志](#/changelog)
+- [Vue 组件库](https://github.com/youzan/vant)
+- [React 组件库](https://www.youzanyun.com/zanui/zent)
### 开源协议
diff --git a/docs/markdown/quickstart.md b/docs/markdown/quickstart.md
index db55c18ac..4ce207390 100644
--- a/docs/markdown/quickstart.md
+++ b/docs/markdown/quickstart.md
@@ -44,7 +44,6 @@ npm i vant-weapp -S --production
}
```
-
### 步骤四 修改 app.json
将 app.json 中的 `"style": "v2"` 去除,小程序的[新版基础组件](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#style)强行加上了许多样式,难以去除,不关闭将造成部分组件样式混乱。
diff --git a/docs/markdown/theme.md b/docs/markdown/theme.md
index a971d8005..a12c243c0 100644
--- a/docs/markdown/theme.md
+++ b/docs/markdown/theme.md
@@ -4,7 +4,7 @@
小程序基于 [Shadow DOM](https://developers.google.com/web/fundamentals/web-components/shadowdom?hl=zh-cn) 来实现自定义组件,所以 Vant Weapp 使用与之配套的 [Css 变量](https://developer.mozilla.org/zh-CN/docs/Web/CSS/Using_CSS_custom_properties) 来实现定制主题。链接中的内容可以帮助你对这两个概念有基本的认识,避免许多不必要的困扰。
-Css变量 的兼容性要求可以在 [这里](https://caniuse.com/#feat=css-variables) 查看。对于不支持 Css变量 的设备,定制主题将不会生效,不过不必担心,默认样式仍会生效。
+Css 变量 的兼容性要求可以在 [这里](https://caniuse.com/#feat=css-variables) 查看。对于不支持 Css 变量 的设备,定制主题将不会生效,不过不必担心,默认样式仍会生效。
### 样式变量
@@ -52,7 +52,7 @@ Page({
buttonStyle: `
--button-border-radius: 10px;
--button-default-color: green;
- `
+ `,
},
onLoad() {
@@ -61,16 +61,16 @@ Page({
buttonStyle: `
--button-border-radius: 2px;
--button-default-color: pink;
- `
+ `,
});
}, 2000);
- }
+ },
});
```
### 定制多个组件的主题样式
-> 与单个组件的定制方式类似,只需用一个container节点包裹住需要定制的组件,并将 Css变量 设置在container节点上
+> 与单个组件的定制方式类似,只需用一个 container 节点包裹住需要定制的组件,并将 Css 变量 设置在 container 节点上
```html
@@ -88,7 +88,7 @@ import Toast from 'path/to/vant-weapp/dist/toast/toast';
Page({
onClick() {
Toast('我是提示文案,建议不超过十五字~');
- }
+ },
});
```
@@ -103,7 +103,7 @@ Page({
### 定制全局主题样式
-> 在 app.wxss 中,写入 Css变量,即可对全局生效
+> 在 app.wxss 中,写入 Css 变量,即可对全局生效
```less
page {
@@ -113,4 +113,3 @@ page {
--toast-background-color: pink;
}
```
-
diff --git a/docs/src/App.vue b/docs/src/App.vue
index bf933c775..6fc1fd652 100644
--- a/docs/src/App.vue
+++ b/docs/src/App.vue
@@ -15,19 +15,13 @@
import pkgJson from '../../package.json';
import docConfig, { github, versions } from './doc.config';
-const UNSHARED = [
- 'common',
- 'quickstart',
- 'changelog',
- 'intro',
- 'transition'
-];
+const UNSHARED = ['common', 'quickstart', 'changelog', 'intro', 'transition'];
export default {
data() {
return {
github,
- versions
+ versions,
};
},
@@ -40,7 +34,10 @@ export default {
let prefix = '';
const { path } = this.$route.meta;
- if (location.hostname === '0.0.0.0' || location.hostname === 'localhost') {
+ if (
+ location.hostname === '0.0.0.0' ||
+ location.hostname === 'localhost'
+ ) {
prefix = 'https://youzan.github.io';
}
@@ -49,7 +46,7 @@ export default {
}
return `./preview.html#${path}`;
- }
+ },
},
methods: {
@@ -57,15 +54,15 @@ export default {
if (version !== pkgJson.version) {
location.href = `https://youzan.github.io/vant-weapp/${version}`;
}
- }
- }
+ },
+ },
};
+```
+
+### 底部内容
+
+通过默认插槽可以在 Empty 组件的下方插入内容
+
+```html
+
+
+ 按钮
+
+
+
+
+```
+
+## API
+
+### Props
+
+| 参数 | 说明 | 类型 | 默认值 |
+| --- | --- | --- | --- |
+| image | 图片类型,可选值为 `error` `network` `search`,支持传入图片 URL | _string_ | `default` |
+| description | 图片下方的描述文字 | _string_ | - |
+
+### Slots
+
+| 名称 | 说明 |
+| ----------- | -------------- |
+| default | 自定义底部内容 |
+| image | 自定义图标 |
+| description | 自定义描述文字 |
diff --git a/packages/empty/index.json b/packages/empty/index.json
new file mode 100644
index 000000000..e8cfaaf80
--- /dev/null
+++ b/packages/empty/index.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/packages/empty/index.less b/packages/empty/index.less
new file mode 100644
index 000000000..810b7ee08
--- /dev/null
+++ b/packages/empty/index.less
@@ -0,0 +1,33 @@
+@import '../common/style/var.less';
+@import '../common/style/theme.less';
+
+.van-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ box-sizing: border-box;
+ padding: @empty-padding;
+
+ &__image {
+ width: @empty-image-size;
+ height: @empty-image-size;
+
+ &__img {
+ width: 100%;
+ height: 100%;
+ }
+ }
+
+ &__description {
+ margin-top: @empty-description-margin-top;
+ padding: @empty-description-padding;
+ color: @empty-description-color;
+ font-size: @empty-description-font-size;
+ line-height: @empty-description-line-height;
+ }
+
+ &__bottom {
+ margin-top: @empty-bottom-margin-top;
+ }
+}
diff --git a/packages/empty/index.ts b/packages/empty/index.ts
new file mode 100644
index 000000000..044faba93
--- /dev/null
+++ b/packages/empty/index.ts
@@ -0,0 +1,22 @@
+import { VantComponent } from '../common/component';
+
+const PRESETS = ['error', 'search', 'default', 'network'];
+
+VantComponent({
+ props: {
+ description: String,
+ image: {
+ type: String,
+ value: 'default',
+ },
+ },
+ created() {
+ if (PRESETS.indexOf(this.data.image) !== -1) {
+ this.setData({
+ imageUrl: `https://img.yzcdn.cn/vant/empty-image-${this.data.image}.png`,
+ });
+ } else {
+ this.setData({ imageUrl: this.data.image });
+ }
+ },
+});
diff --git a/packages/empty/index.wxml b/packages/empty/index.wxml
new file mode 100644
index 000000000..1c2846970
--- /dev/null
+++ b/packages/empty/index.wxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ {{ description }}
+
+
+
+
+
\ No newline at end of file
From 44194c711eb884c2767a66d42e40bed938c2a1ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Wuli=E9=94=A4=E9=94=A4?= <980198595@qq.com>
Date: Wed, 8 Jul 2020 15:43:01 +0800
Subject: [PATCH 0325/1249] fix(Area): When setting the attribute
[columns-num=1 or columns-num=2] lower than the WeChat basic library version
2.7.7, the real machine environment reports an error (#3318)
---
packages/area/index.ts | 41 ++++++++++++++++++++++-------------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/packages/area/index.ts b/packages/area/index.ts
index c2c9a21ab..e647570a9 100644
--- a/packages/area/index.ts
+++ b/packages/area/index.ts
@@ -201,31 +201,34 @@ VantComponent({
}
const stack = [];
+ const indexes = [];
- stack.push(picker.setColumnValues(0, province, false));
- stack.push(picker.setColumnValues(1, city, false));
+ if (this.data.columnsNum >= 1) {
+ stack.push(picker.setColumnValues(0, province, false));
+ indexes.push(this.getIndex('province', code));
+ }
- if (city.length && code.slice(2, 4) === '00') {
- [{ code }] = city;
+ if (this.data.columnsNum >= 2) {
+ stack.push(picker.setColumnValues(1, city, false));
+ indexes.push(this.getIndex('province', code));
+ if (city.length && code.slice(2, 4) === '00') {
+ [{ code }] = city;
+ }
}
- stack.push(
- picker.setColumnValues(
- 2,
- this.getList('county', code.slice(0, 4)),
- false
- )
- );
+ if (this.data.columnsNum === 3) {
+ stack.push(
+ picker.setColumnValues(
+ 2,
+ this.getList('county', code.slice(0, 4)),
+ false
+ )
+ );
+ }
return Promise.all(stack)
.catch(() => {})
- .then(() =>
- picker.setIndexes([
- this.getIndex('province', code),
- this.getIndex('city', code),
- this.getIndex('county', code),
- ])
- )
+ .then(() => picker.setIndexes(indexes))
.catch(() => {});
},
@@ -267,4 +270,4 @@ VantComponent({
return this.setValues();
},
},
-});
+});
\ No newline at end of file
From fa54a19805722b818569c6eeb3cc2b2313272202 Mon Sep 17 00:00:00 2001
From: rex
Date: Thu, 9 Jul 2020 14:15:02 +0800
Subject: [PATCH 0326/1249] fix(datetime-picker): update value with origin
column after change (#3352)
---
packages/datetime-picker/index.ts | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/packages/datetime-picker/index.ts b/packages/datetime-picker/index.ts
index c638defb9..190cc6f9a 100644
--- a/packages/datetime-picker/index.ts
+++ b/packages/datetime-picker/index.ts
@@ -103,7 +103,7 @@ VantComponent({
methods: {
updateValue() {
const { data } = this;
- const val = this.correctValue(this.data.value);
+ const val = this.correctValue(data.value);
const isEqual = val === data.innerValue;
if (!isEqual) {
this.updateColumnValue(val).then(() => {
@@ -291,13 +291,17 @@ VantComponent({
let value;
const picker = this.getPicker();
+ const originColumns = this.getOriginColumns();
if (data.type === 'time') {
const indexes = picker.getIndexes();
- value = `${+data.columns[0].values[indexes[0]]}:${+data.columns[1]
+ value = `${+originColumns[0].values[indexes[0]]}:${+originColumns[1]
.values[indexes[1]]}`;
} else {
- const values = picker.getValues();
+ const indexes = picker.getIndexes();
+ const values = indexes.map(
+ (value, index) => originColumns[index].values[value]
+ );
const year = getTrueValue(values[0]);
const month = getTrueValue(values[1]);
const maxDate = getMonthEndDay(year, month);
@@ -324,7 +328,8 @@ VantComponent({
updateColumnValue(value) {
let values = [];
- const { type, formatter = defaultFormatter } = this.data;
+ const { type } = this.data;
+ const formatter = this.data.formatter || defaultFormatter;
const picker = this.getPicker();
if (type === 'time') {
From da4a5f3cd4f86efeafc4bef4f902e2ecd6f9e768 Mon Sep 17 00:00:00 2001
From: neverland
Date: Thu, 9 Jul 2020 15:30:40 +0800
Subject: [PATCH 0327/1249] feat(Field): update label style (#3357)
---
packages/common/style/var.less | 2 ++
packages/field/README.md | 2 +-
packages/field/index.less | 5 +++++
packages/field/index.ts | 18 +++++++++---------
packages/field/index.wxml | 6 ++++--
5 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/packages/common/style/var.less b/packages/common/style/var.less
index 03dfe94e8..8b483fb86 100644
--- a/packages/common/style/var.less
+++ b/packages/common/style/var.less
@@ -234,6 +234,8 @@
@dialog-has-title-message-padding-top: @padding-sm;
// Field
+@field-label-color: @gray-7;
+@field-label-margin-right: @padding-sm;
@field-input-text-color: @text-color;
@field-input-error-text-color: @red;
@field-input-disabled-text-color: @gray-6;
diff --git a/packages/field/README.md b/packages/field/README.md
index b9aeaae76..ab7d52337 100644
--- a/packages/field/README.md
+++ b/packages/field/README.md
@@ -206,7 +206,7 @@ Page({
| clickable | 是否开启点击反馈 | _boolean_ | `false` |
| required | 是否显示表单必填星号 | _boolean_ | `false` |
| password | 是否是密码类型 | _boolean_ | `false` |
-| title-width | 标题宽度 | _string_ | `90px` |
+| title-width | 标题宽度 | _string_ | `6.2em` |
| maxlength | 最大输入长度,设置为 -1 的时候不限制最大长度 | _number_ | `-1` |
| placeholder | 输入框为空时占位符 | _string_ | - |
| placeholder-style | 指定 placeholder 的样式 | _string_ | - |
diff --git a/packages/field/index.less b/packages/field/index.less
index e56565ac7..863fe07ef 100644
--- a/packages/field/index.less
+++ b/packages/field/index.less
@@ -4,6 +4,11 @@
.van-field {
.theme(--cell-icon-size, '@field-icon-size');
+ &__label {
+ .theme(color, '@field-label-color');
+ .theme(margin-right, '@field-label-margin-right');
+ }
+
&__body {
display: flex;
align-items: center;
diff --git a/packages/field/index.ts b/packages/field/index.ts
index c4123e8cc..9ecc3975f 100644
--- a/packages/field/index.ts
+++ b/packages/field/index.ts
@@ -20,16 +20,8 @@ VantComponent({
leftIcon: String,
rightIcon: String,
autosize: [Boolean, Object],
- readonly: {
- type: Boolean,
- observer: 'setShowClear',
- },
required: Boolean,
iconClass: String,
- clearable: {
- type: Boolean,
- observer: 'setShowClear',
- },
clickable: Boolean,
inputAlign: String,
customStyle: String,
@@ -37,13 +29,21 @@ VantComponent({
arrowDirection: String,
showWordLimit: Boolean,
errorMessageAlign: String,
+ readonly: {
+ type: Boolean,
+ observer: 'setShowClear',
+ },
+ clearable: {
+ type: Boolean,
+ observer: 'setShowClear',
+ },
border: {
type: Boolean,
value: true,
},
titleWidth: {
type: String,
- value: '90px',
+ value: '6.2em',
},
},
diff --git a/packages/field/index.wxml b/packages/field/index.wxml
index c984d8971..41102af7e 100644
--- a/packages/field/index.wxml
+++ b/packages/field/index.wxml
@@ -4,7 +4,6 @@
-
+
+ {{ label }}
+
+
Date: Fri, 17 Jul 2020 16:33:15 +0800
Subject: [PATCH 0349/1249] build: release 1.4.0
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index aa10ad4c0..a95d53343 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
- "version": "1.4.0-beta.3",
+ "version": "1.4.0",
"author": "youzan",
"license": "MIT",
"miniprogram": "lib",
From ed8b8373b5387118f085882603de881d9719dbbd Mon Sep 17 00:00:00 2001
From: rex
Date: Sat, 18 Jul 2020 21:19:20 +0800
Subject: [PATCH 0350/1249] docs(changelog): release 1.4.0
---
docs/markdown/changelog.md | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/docs/markdown/changelog.md b/docs/markdown/changelog.md
index 120e852ca..30a2dedbe 100644
--- a/docs/markdown/changelog.md
+++ b/docs/markdown/changelog.md
@@ -1,5 +1,34 @@
# 更新日志
+### [v1.4.0](https://github.com/youzan/vant-weapp/tree/v1.4.0)
+`2020-07-17`
+
+**Features**
+
+- Empty: 新增 Empty 组件 [\#3327](https://github.com/youzan/vant-weapp/pull/3327)
+- NoticeBar: 新增 background 属性 [\#3388](https://github.com/youzan/vant-weapp/pull/3388)
+- NoticeBar: 新增 close 事件 [\#3388](https://github.com/youzan/vant-weapp/pull/3388)
+- GridItem: 新增 icon-color 属性 [\#3386](https://github.com/youzan/vant-weapp/pull/3386)
+- NavBar: 现在 custom-style 将影响根节点[\#3371](https://github.com/youzan/vant-weapp/pull/3371)
+- Cell: 新增 title-style 属性, fix Field label width [\#3370](https://github.com/youzan/vant-weapp/pull/3370)
+- Uploader: 更新 failed 图标 [\#3359](https://github.com/youzan/vant-weapp/pull/3359)
+- Uploader: 更新删除图标样式 [\#3385](https://github.com/youzan/vant-weapp/pull/3385)
+- Uploader: 移除圆角样式 [\#3384](https://github.com/youzan/vant-weapp/pull/3384)
+- Field: 更新禁用态样式 [\#3358](https://github.com/youzan/vant-weapp/pull/3358)
+- Field: 更新 label 样式 [\#3357](https://github.com/youzan/vant-weapp/pull/3357)
+- Picker: 调整 action button 样式 [\#3316](https://github.com/youzan/vant-weapp/pull/3316)
+
+**Bug Fixes**
+
+- Collapse: 使用 animation 重构动画部分逻辑以修复动画卡顿 [\#3401](https://github.com/youzan/vant-weapp/pull/3401)
+- Uploader: 修复 loading 样式错误、调整 previewSize 属性默认值 [\#3317](https://github.com/youzan/vant-weapp/pull/3317)
+- Area: 修复低版本基础库下 columns-num 设置为 1 或 2 时真机环境报错 [\#3318](https://github.com/youzan/vant-weapp/pull/3318)
+- DatetimePicker: 修复使用 formatter 时,事件返回值可能不正确 [\#3352](https://github.com/youzan/vant-weapp/pull/3352)
+- Field: 修复 textarea 模式下 label 与 value 不在同一水平线上 [\#3383](https://github.com/youzan/vant-weapp/pull/3383)
+- Dialog: show dialog after class ready [\#3374](https://github.com/youzan/vant-weapp/pull/3374)
+- Calendar: confirm-disabled-text 属性增加默认值 [\#3394](https://github.com/youzan/vant-weapp/pull/3394)
+
+
### [v1.3.3](https://github.com/youzan/vant-weapp/tree/v1.3.3)
`2020-06-24`
From 2855aa91d90f333a00dcdb8e8a362fabe723a171 Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 21 Jul 2020 09:43:15 +0800
Subject: [PATCH 0351/1249] docs(field): add example for two way binding
(#3414)
fix #3341
---
packages/field/README.md | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/packages/field/README.md b/packages/field/README.md
index ab7d52337..9d2378987 100644
--- a/packages/field/README.md
+++ b/packages/field/README.md
@@ -42,6 +42,28 @@ Page({
});
```
+### 双向绑定
+
+最低基础库版本在 2.9.3 以上时,可以使用[简易双向绑定](https://developers.weixin.qq.com/miniprogram/dev/framework/view/two-way-bindings.html)
+
+```html
+
+
+
+```
+
+```js
+Page({
+ data: {
+ value: '',
+ },
+});
+```
+
### 自定义类型
根据`type`属性定义不同类型的输入框
From cfbf07bb8a101470dba791c56005a87b6b8a96ab Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 21 Jul 2020 11:05:43 +0800
Subject: [PATCH 0352/1249] fix(slider): avoid emit drag on click (#3415)
fix #3378
---
packages/slider/index.ts | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/packages/slider/index.ts b/packages/slider/index.ts
index e06acddaa..f4bcebaa4 100644
--- a/packages/slider/index.ts
+++ b/packages/slider/index.ts
@@ -13,25 +13,29 @@ VantComponent({
inactiveColor: String,
max: {
type: Number,
- value: 100,
+ value: 100
},
min: {
type: Number,
- value: 0,
+ value: 0
},
step: {
type: Number,
- value: 1,
+ value: 1
},
value: {
type: Number,
value: 0,
- observer: 'updateValue',
+ observer(val) {
+ if (val !== this.value) {
+ this.updateValue(val);
+ }
+ }
},
barHeight: {
type: null,
- value: '2px',
- },
+ value: 2
+ }
},
created() {
@@ -43,7 +47,7 @@ VantComponent({
if (this.data.disabled) return;
this.touchStart(event);
- this.startValue = this.format(this.data.value);
+ this.startValue = this.format(this.value);
this.dragStatus = 'start';
},
@@ -94,12 +98,13 @@ VantComponent({
const { min } = this.data;
const width = `${((value - min) * 100) / this.getRange()}%`;
+ this.value = value;
+
this.setData({
- value,
barStyle: `
width: ${width};
${drag ? 'transition: none;' : ''}
- `,
+ `
});
if (drag) {
@@ -123,6 +128,6 @@ VantComponent({
format(value: number) {
const { max, min, step } = this.data;
return Math.round(Math.max(min, Math.min(value, max)) / step) * step;
- },
- },
+ }
+ }
});
From 40072f6d4c2fd4374a3cccd220220f36300b401c Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 21 Jul 2020 11:13:05 +0800
Subject: [PATCH 0353/1249] docs(calendar): add doc for min-date & max-date
(#3416)
fix #3096
---
packages/calendar/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/calendar/README.md b/packages/calendar/README.md
index 44bf73e5d..b6290e445 100644
--- a/packages/calendar/README.md
+++ b/packages/calendar/README.md
@@ -142,7 +142,7 @@ Page({
### 自定义日期范围
-通过`min-date`和`max-date`定义日历的范围
+通过`min-date`和`max-date`定义日历的范围,需要注意的是`min-date`和`max-date`的区间不宜过大,否则会造成严重的性能问题。
```html
Date: Tue, 21 Jul 2020 14:16:10 +0800
Subject: [PATCH 0354/1249] feat(Picker): adjust default value of
visible-item-count to 6 (#3418)
---
packages/area/README.md | 2 +-
packages/datetime-picker/README.md | 2 +-
packages/picker/README.md | 2 +-
packages/picker/shared.ts | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/packages/area/README.md b/packages/area/README.md
index 4935de293..5e6efab83 100644
--- a/packages/area/README.md
+++ b/packages/area/README.md
@@ -91,7 +91,7 @@ db.collection('region')
| columns-placeholder | 列占位提示文字 | _string[]_ | `[]` | - |
| loading | 是否显示加载状态 | _boolean_ | `false` | - |
| item-height | 选项高度 | _number_ | `44` | - |
-| visible-item-count | 可见的选项个数 | _number_ | `5` | - |
+| visible-item-count | 可见的选项个数 | _number_ | `6` | - |
| confirm-button-text | 确认按钮文字 | _string_ | `确认` | - |
| cancel-button-text | 取消按钮文字 | _string_ | `取消` | - |
diff --git a/packages/datetime-picker/README.md b/packages/datetime-picker/README.md
index 5e7a03dba..a1a882250 100644
--- a/packages/datetime-picker/README.md
+++ b/packages/datetime-picker/README.md
@@ -192,7 +192,7 @@ Page({
| item-height | 选项高度 | _number_ | `44` | - |
| confirm-button-text | 确认按钮文字 | _string_ | `确认` | - |
| cancel-button-text | 取消按钮文字 | _string_ | `取消` | - |
-| visible-item-count | 可见的选项个数 | _number_ | `5` | - |
+| visible-item-count | 可见的选项个数 | _number_ | `6` | - |
### Events
diff --git a/packages/picker/README.md b/packages/picker/README.md
index 317aa5bd3..47333d0e7 100644
--- a/packages/picker/README.md
+++ b/packages/picker/README.md
@@ -157,7 +157,7 @@ Page({
| item-height | 选项高度 | _number_ | `44` | - |
| confirm-button-text | 确认按钮文字 | _string_ | `确认` | - |
| cancel-button-text | 取消按钮文字 | _string_ | `取消` | - |
-| visible-item-count | 可见的选项个数 | _number_ | `5` | - |
+| visible-item-count | 可见的选项个数 | _number_ | `6` | - |
| default-index | 单列选择器的默认选中项索引,
多列选择器请参考下方的 Columns 配置 | _number_ | `0` | - |
### Events
diff --git a/packages/picker/shared.ts b/packages/picker/shared.ts
index a8c96a8b9..8531290b3 100644
--- a/packages/picker/shared.ts
+++ b/packages/picker/shared.ts
@@ -12,7 +12,7 @@ export const pickerProps = {
},
visibleItemCount: {
type: Number,
- value: 5,
+ value: 6,
},
itemHeight: {
type: Number,
From aefad39a3692358dfae85aa99cb0d7e0b46bf552 Mon Sep 17 00:00:00 2001
From: neverland
Date: Tue, 21 Jul 2020 14:16:40 +0800
Subject: [PATCH 0355/1249] feat(Toast): increase border radius to 8px (#3419)
---
packages/common/style/var.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/common/style/var.less b/packages/common/style/var.less
index 9f97cdb22..71ee8619b 100644
--- a/packages/common/style/var.less
+++ b/packages/common/style/var.less
@@ -521,7 +521,7 @@
@toast-font-size: 14px;
@toast-text-color: @white;
@toast-line-height: 20px;
-@toast-border-radius: @border-radius-md;
+@toast-border-radius: @border-radius-lg;
@toast-background-color: rgba(@text-color, 0.88);
@toast-icon-size: 48px;
@toast-text-min-width: 96px;
From 1ad284bb56f3ec12159b89cefad0d2c56f22c188 Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 28 Jul 2020 20:35:28 +0800
Subject: [PATCH 0356/1249] fix(area): fix setValues error (#3443)
fix #3405
---
example/project.config.json | 10 ++++----
packages/area/index.ts | 48 +++++++++++++++++++------------------
2 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/example/project.config.json b/example/project.config.json
index e6fd2153c..1078db16c 100644
--- a/example/project.config.json
+++ b/example/project.config.json
@@ -6,7 +6,6 @@
"setting": {
"urlCheck": false,
"es6": true,
- "enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
@@ -16,19 +15,20 @@
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
- "uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
- "compileHotReLoad": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
- "useIsolateContext": true,
"useCompilerModule": false,
- "userConfirmedUseCompilerModuleSwitch": false
+ "userConfirmedUseCompilerModuleSwitch": false,
+ "enhance": false,
+ "uglifyFileName": false,
+ "compileHotReLoad": false,
+ "useIsolateContext": true
},
"compileType": "miniprogram",
"cloudfunctionRoot": "functions/",
diff --git a/packages/area/index.ts b/packages/area/index.ts
index e647570a9..aa2834335 100644
--- a/packages/area/index.ts
+++ b/packages/area/index.ts
@@ -19,21 +19,21 @@ VantComponent({
observer(value: string) {
this.code = value;
this.setValues();
- },
+ }
},
areaList: {
type: Object,
value: {},
- observer: 'setValues',
+ observer: 'setValues'
},
columnsNum: {
type: null,
value: 3,
observer(value: number) {
this.setData({
- displayColumns: this.data.columns.slice(0, +value),
+ displayColumns: this.data.columns.slice(0, +value)
});
- },
+ }
},
columnsPlaceholder: {
type: Array,
@@ -42,17 +42,17 @@ VantComponent({
typeToColumnsPlaceholder: {
province: val[0] || '',
city: val[1] || '',
- county: val[2] || '',
- },
+ county: val[2] || ''
+ }
});
- },
- },
+ }
+ }
},
data: {
columns: [{ values: [] }, { values: [] }, { values: [] }],
displayColumns: [{ values: [] }, { values: [] }, { values: [] }],
- typeToColumnsPlaceholder: {},
+ typeToColumnsPlaceholder: {}
},
mounted() {
@@ -109,7 +109,7 @@ VantComponent({
this.$emit('change', {
picker,
values: this.parseOutputValues(picker.getValues()),
- index,
+ index
});
});
},
@@ -127,9 +127,9 @@ VantComponent({
}
const list = this.getConfig(type);
- result = Object.keys(list).map((code) => ({
+ result = Object.keys(list).map(code => ({
code,
- name: list[code],
+ name: list[code]
}));
if (code) {
@@ -138,7 +138,7 @@ VantComponent({
code = '9';
}
- result = result.filter((item) => item.code.indexOf(code) === 0);
+ result = result.filter(item => item.code.indexOf(code) === 0);
}
if (typeToColumnsPlaceholder[type] && result.length) {
@@ -151,7 +151,7 @@ VantComponent({
: COLUMNSPLACEHOLDERCODE.slice(4, 6);
result.unshift({
code: `${code}${codeFill}`,
- name: typeToColumnsPlaceholder[type],
+ name: typeToColumnsPlaceholder[type]
});
}
@@ -202,21 +202,22 @@ VantComponent({
const stack = [];
const indexes = [];
+ const { columnsNum } = this.data;
- if (this.data.columnsNum >= 1) {
+ if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, province, false));
indexes.push(this.getIndex('province', code));
}
- if (this.data.columnsNum >= 2) {
+ if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, city, false));
- indexes.push(this.getIndex('province', code));
+ indexes.push(this.getIndex('city', code));
if (city.length && code.slice(2, 4) === '00') {
[{ code }] = city;
}
}
- if (this.data.columnsNum === 3) {
+ if (columnsNum === 3) {
stack.push(
picker.setColumnValues(
2,
@@ -224,6 +225,7 @@ VantComponent({
false
)
);
+ indexes.push(this.getIndex('county', code));
}
return Promise.all(stack)
@@ -234,7 +236,7 @@ VantComponent({
getValues() {
const picker = this.getPicker();
- return picker ? picker.getValues().filter((value) => !!value) : [];
+ return picker ? picker.getValues().filter(value => !!value) : [];
},
getDetail() {
@@ -244,7 +246,7 @@ VantComponent({
country: '',
province: '',
city: '',
- county: '',
+ county: ''
};
if (!values.length) {
@@ -268,6 +270,6 @@ VantComponent({
reset(code) {
this.code = code || '';
return this.setValues();
- },
- },
-});
\ No newline at end of file
+ }
+ }
+});
From 367878b19818932bfe5bb9a3de146a46e0a529d6 Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 28 Jul 2020 20:52:00 +0800
Subject: [PATCH 0357/1249] build: compile 1.4.1
---
.github_changelog_generator | 6 ++++++
dist/area/index.js | 10 ++++++----
dist/picker/shared.js | 2 +-
dist/slider/index.js | 12 ++++++++----
dist/toast/index.wxss | 2 +-
lib/area/index.js | 10 ++++++----
lib/picker/shared.js | 2 +-
lib/slider/index.js | 12 ++++++++----
lib/toast/index.wxss | 2 +-
package.json | 1 +
yarn.lock | 10 +++++++++-
11 files changed, 48 insertions(+), 21 deletions(-)
create mode 100644 .github_changelog_generator
diff --git a/.github_changelog_generator b/.github_changelog_generator
new file mode 100644
index 000000000..1d6614337
--- /dev/null
+++ b/.github_changelog_generator
@@ -0,0 +1,6 @@
+project=vant-weapp
+user=youzan
+since-tag=v1.3.0
+token=0935f6bd6b40169f1bc45bba0782e309d4a13017
+exclude-labels=duplicate,question,invalid,wontfix
+issues=false
\ No newline at end of file
diff --git a/dist/area/index.js b/dist/area/index.js
index d77fcf8e7..c6216823a 100644
--- a/dist/area/index.js
+++ b/dist/area/index.js
@@ -166,18 +166,19 @@ VantComponent({
}
const stack = [];
const indexes = [];
- if (this.data.columnsNum >= 1) {
+ const { columnsNum } = this.data;
+ if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, province, false));
indexes.push(this.getIndex('province', code));
}
- if (this.data.columnsNum >= 2) {
+ if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, city, false));
- indexes.push(this.getIndex('province', code));
+ indexes.push(this.getIndex('city', code));
if (city.length && code.slice(2, 4) === '00') {
[{ code }] = city;
}
}
- if (this.data.columnsNum === 3) {
+ if (columnsNum === 3) {
stack.push(
picker.setColumnValues(
2,
@@ -185,6 +186,7 @@ VantComponent({
false
)
);
+ indexes.push(this.getIndex('county', code));
}
return Promise.all(stack)
.catch(() => {})
diff --git a/dist/picker/shared.js b/dist/picker/shared.js
index a8c96a8b9..8531290b3 100644
--- a/dist/picker/shared.js
+++ b/dist/picker/shared.js
@@ -12,7 +12,7 @@ export const pickerProps = {
},
visibleItemCount: {
type: Number,
- value: 5,
+ value: 6,
},
itemHeight: {
type: Number,
diff --git a/dist/slider/index.js b/dist/slider/index.js
index 73c62a7f8..974329204 100644
--- a/dist/slider/index.js
+++ b/dist/slider/index.js
@@ -23,11 +23,15 @@ VantComponent({
value: {
type: Number,
value: 0,
- observer: 'updateValue',
+ observer(val) {
+ if (val !== this.value) {
+ this.updateValue(val);
+ }
+ },
},
barHeight: {
type: null,
- value: '2px',
+ value: 2,
},
},
created() {
@@ -37,7 +41,7 @@ VantComponent({
onTouchStart(event) {
if (this.data.disabled) return;
this.touchStart(event);
- this.startValue = this.format(this.data.value);
+ this.startValue = this.format(this.value);
this.dragStatus = 'start';
},
onTouchMove(event) {
@@ -73,8 +77,8 @@ VantComponent({
value = this.format(value);
const { min } = this.data;
const width = `${((value - min) * 100) / this.getRange()}%`;
+ this.value = value;
this.setData({
- value,
barStyle: `
width: ${width};
${drag ? 'transition: none;' : ''}
diff --git a/dist/toast/index.wxss b/dist/toast/index.wxss
index da946c9bd..2a98d2e29 100644
--- a/dist/toast/index.wxss
+++ b/dist/toast/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:4px;border-radius:var(--toast-border-radius,4px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
+@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
diff --git a/lib/area/index.js b/lib/area/index.js
index 4f158fbb4..d02aa1544 100644
--- a/lib/area/index.js
+++ b/lib/area/index.js
@@ -192,18 +192,19 @@ component_1.VantComponent({
}
var stack = [];
var indexes = [];
- if (this.data.columnsNum >= 1) {
+ var columnsNum = this.data.columnsNum;
+ if (columnsNum >= 1) {
stack.push(picker.setColumnValues(0, province, false));
indexes.push(this.getIndex('province', code));
}
- if (this.data.columnsNum >= 2) {
+ if (columnsNum >= 2) {
stack.push(picker.setColumnValues(1, city, false));
- indexes.push(this.getIndex('province', code));
+ indexes.push(this.getIndex('city', code));
if (city.length && code.slice(2, 4) === '00') {
code = city[0].code;
}
}
- if (this.data.columnsNum === 3) {
+ if (columnsNum === 3) {
stack.push(
picker.setColumnValues(
2,
@@ -211,6 +212,7 @@ component_1.VantComponent({
false
)
);
+ indexes.push(this.getIndex('county', code));
}
return Promise.all(stack)
.catch(function () {})
diff --git a/lib/picker/shared.js b/lib/picker/shared.js
index 4081f5467..9b2ca48aa 100644
--- a/lib/picker/shared.js
+++ b/lib/picker/shared.js
@@ -15,7 +15,7 @@ exports.pickerProps = {
},
visibleItemCount: {
type: Number,
- value: 5,
+ value: 6,
},
itemHeight: {
type: Number,
diff --git a/lib/slider/index.js b/lib/slider/index.js
index f945c1012..1001a4dd6 100644
--- a/lib/slider/index.js
+++ b/lib/slider/index.js
@@ -25,11 +25,15 @@ component_1.VantComponent({
value: {
type: Number,
value: 0,
- observer: 'updateValue',
+ observer: function (val) {
+ if (val !== this.value) {
+ this.updateValue(val);
+ }
+ },
},
barHeight: {
type: null,
- value: '2px',
+ value: 2,
},
},
created: function () {
@@ -39,7 +43,7 @@ component_1.VantComponent({
onTouchStart: function (event) {
if (this.data.disabled) return;
this.touchStart(event);
- this.startValue = this.format(this.data.value);
+ this.startValue = this.format(this.value);
this.dragStatus = 'start';
},
onTouchMove: function (event) {
@@ -77,8 +81,8 @@ component_1.VantComponent({
value = this.format(value);
var min = this.data.min;
var width = ((value - min) * 100) / this.getRange() + '%';
+ this.value = value;
this.setData({
- value: value,
barStyle:
'\n width: ' +
width +
diff --git a/lib/toast/index.wxss b/lib/toast/index.wxss
index da946c9bd..2a98d2e29 100644
--- a/lib/toast/index.wxss
+++ b/lib/toast/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:4px;border-radius:var(--toast-border-radius,4px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
+@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
diff --git a/package.json b/package.json
index a95d53343..fd30b02af 100644
--- a/package.json
+++ b/package.json
@@ -75,6 +75,7 @@
"progress-bar-webpack-plugin": "^1.11.0",
"style-loader": "^1.0.0",
"stylelint": "^13.0.0",
+ "tscpaths": "^0.0.9",
"typescript": "^3.8.0",
"vue": "2.6.10",
"vue-loader": "^15.7.1",
diff --git a/yarn.lock b/yarn.lock
index ff2c21b4e..407d0f635 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -5855,7 +5855,7 @@ globby@^6.1.0:
pify "^2.0.0"
pinkie-promise "^2.0.0"
-globby@^9.0.0:
+globby@^9.0.0, globby@^9.2.0:
version "9.2.0"
resolved "https://registry.npmjs.org/globby/-/globby-9.2.0.tgz#fd029a706c703d29bdd170f4b6db3a3f7a7cb63d"
integrity sha512-ollPHROa5mcxDEkwg6bPt3QbEf4pDQSNtd6JPL1YvOvAo/7/0VAm9TccUeoTmarjPw4pfUthSCqcyfNB1I3ZSg==
@@ -11556,6 +11556,14 @@ trough@^1.0.0:
resolved "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz#b8b639cefad7d0bb2abd37d433ff8293efa5f406"
integrity sha512-rvuRbTarPXmMb79SmzEp8aqXNKcK+y0XaB298IXueQ8I2PsrATcPBCSPyK/dDNa2iWOhKlfNnOjdAOTBU/nkFA==
+tscpaths@^0.0.9:
+ version "0.0.9"
+ resolved "https://registry.npm.taobao.org/tscpaths/download/tscpaths-0.0.9.tgz#c77abfde6820920f10c64f83c27753b9505814ab"
+ integrity sha1-x3q/3mggkg8Qxk+DwndTuVBYFKs=
+ dependencies:
+ commander "^2.20.0"
+ globby "^9.2.0"
+
tslib@1.10.0:
version "1.10.0"
resolved "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
From f56f02e9c7cd554094d4131f964e37b39117e6f3 Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 28 Jul 2020 20:52:05 +0800
Subject: [PATCH 0358/1249] build: release 1.4.1
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index fd30b02af..60733e536 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
- "version": "1.4.0",
+ "version": "1.4.1",
"author": "youzan",
"license": "MIT",
"miniprogram": "lib",
From deb670e285b2cf8e70b2383844bcb300893edb8a Mon Sep 17 00:00:00 2001
From: neverland
Date: Wed, 29 Jul 2020 18:14:40 +0800
Subject: [PATCH 0359/1249] feat(Toast): update style (#3451)
---
example/pages/toast/index.js | 19 +++++++++++++------
example/pages/toast/index.wxml | 15 ++++++++-------
packages/common/style/var.less | 8 ++++----
packages/toast/README.md | 16 ++++++++++++----
4 files changed, 37 insertions(+), 21 deletions(-)
diff --git a/example/pages/toast/index.js b/example/pages/toast/index.js
index e544b94a0..7b30a6239 100644
--- a/example/pages/toast/index.js
+++ b/example/pages/toast/index.js
@@ -11,7 +11,15 @@ Page({
},
showLoadingToast() {
- Toast.loading({ mask: true, message: '加载中...' });
+ Toast.loading({ message: '加载中...', forbidClick: true });
+ },
+
+ showCustomLoadingToast() {
+ Toast.loading({
+ message: '加载中...',
+ forbidClick: true,
+ loadingType: 'spinner',
+ });
},
showSuccessToast() {
@@ -22,13 +30,12 @@ Page({
Toast.fail('失败提示');
},
- showCustomizedToast(duration) {
- const text = second => `倒计时 ${second} 秒`;
+ showCustomizedToast() {
+ const text = (second) => `倒计时 ${second} 秒`;
const toast = Toast.loading({
duration: 0,
forbidClick: true,
- loadingType: 'spinner',
- message: text(3)
+ message: text(3),
});
let second = 3;
@@ -41,5 +48,5 @@ Page({
Toast.clear();
}
}, 1000);
- }
+ },
});
diff --git a/example/pages/toast/index.wxml b/example/pages/toast/index.wxml
index addf67962..67b83ce09 100644
--- a/example/pages/toast/index.wxml
+++ b/example/pages/toast/index.wxml
@@ -1,19 +1,20 @@
- 文字提示
- 长文字提示
+ 文字提示
+ 长文字提示
- 加载提示
+ 加载提示
+ 自定义加载图标
- 成功提示
- 失败提示
+ 成功提示
+ 失败提示
-
- 高级用法
+
+ 动态更新提示
diff --git a/packages/common/style/var.less b/packages/common/style/var.less
index 71ee8619b..cd5f0b744 100644
--- a/packages/common/style/var.less
+++ b/packages/common/style/var.less
@@ -522,13 +522,13 @@
@toast-text-color: @white;
@toast-line-height: 20px;
@toast-border-radius: @border-radius-lg;
-@toast-background-color: rgba(@text-color, 0.88);
-@toast-icon-size: 48px;
+@toast-background-color: fade(@black, 70%);
+@toast-icon-size: 36px;
@toast-text-min-width: 96px;
@toast-text-padding: @padding-xs @padding-sm;
@toast-default-padding: @padding-md;
-@toast-default-width: 90px;
-@toast-default-min-height: 90px;
+@toast-default-width: 88px;
+@toast-default-min-height: 88px;
// GridItem
@grid-item-content-padding: @padding-md @padding-xs;
diff --git a/packages/toast/README.md b/packages/toast/README.md
index e320cd034..a26baa82b 100644
--- a/packages/toast/README.md
+++ b/packages/toast/README.md
@@ -26,10 +26,19 @@ Toast('我是提示文案,建议不超过十五字~');
### 加载提示
+使用 `Toast.loading` 方法展示加载提示,通过 `forbidClick` 属性可以禁用背景点击,通过 `loadingType` 属性可以自定义加载图标类型。
+
```javascript
Toast.loading({
- mask: true,
message: '加载中...',
+ forbidClick: true,
+});
+
+// 自定义加载图标
+Toast.loading({
+ message: '加载中...',
+ forbidClick: true,
+ loadingType: 'spinner',
});
```
@@ -40,14 +49,13 @@ Toast.success('成功文案');
Toast.fail('失败文案');
```
-### 高级用法
+### 动态更新提示
```javascript
const toast = Toast.loading({
duration: 0, // 持续展示 toast
- forbidClick: true, // 禁用背景点击
+ forbidClick: true,
message: '倒计时 3 秒',
- loadingType: 'spinner',
selector: '#custom-selector',
});
From 92a3484cb94ea8b5f25224dd6eda63cae73cf644 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Thu, 30 Jul 2020 21:17:01 +0800
Subject: [PATCH 0360/1249] build(deps): bump elliptic from 6.5.2 to 6.5.3
(#3456)
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.3)
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
yarn.lock | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/yarn.lock b/yarn.lock
index 407d0f635..35bacac21 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3256,7 +3256,7 @@ braces@^3.0.1, braces@~3.0.2:
brorand@^1.0.1:
version "1.1.0"
- resolved "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
+ resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f"
integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=
browserify-aes@^1.0.0, browserify-aes@^1.0.4:
@@ -4727,9 +4727,9 @@ elegant-spinner@^2.0.0:
integrity sha512-5YRYHhvhYzV/FC4AiMdeSIg3jAYGq9xFvbhZMpPlJoBsfYgrw2DSCYeXfat6tYBu45PWiyRr3+flaCPPmviPaA==
elliptic@^6.0.0, elliptic@^6.5.2:
- version "6.5.2"
- resolved "https://registry.npmjs.org/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762"
- integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw==
+ version "6.5.3"
+ resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.3.tgz#cb59eb2efdaf73a0bd78ccd7015a62ad6e0f93d6"
+ integrity sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==
dependencies:
bn.js "^4.4.0"
brorand "^1.0.1"
@@ -6095,7 +6095,7 @@ hash-sum@^1.0.2:
hash.js@^1.0.0, hash.js@^1.0.3:
version "1.1.7"
- resolved "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
+ resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.1.7.tgz#0babca538e8d4ee4a0f8988d68866537a003cf42"
integrity sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==
dependencies:
inherits "^2.0.3"
@@ -6128,7 +6128,7 @@ highlight.js@^9.16.2:
hmac-drbg@^1.0.0:
version "1.0.1"
- resolved "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
+ resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
integrity sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=
dependencies:
hash.js "^1.0.3"
@@ -7941,12 +7941,12 @@ min-indent@^1.0.0:
minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1:
version "1.0.1"
- resolved "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
+ resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7"
integrity sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==
minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1:
version "1.0.1"
- resolved "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
+ resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=
minimatch@3.0.4, minimatch@^3.0.4:
From 87c6ef6d9e6e67f09b1169347a45c5a035b844fb Mon Sep 17 00:00:00 2001
From: agoni1212 <22545824+agoni1212@users.noreply.github.com>
Date: Fri, 31 Jul 2020 14:09:51 +0800
Subject: [PATCH 0361/1249] Update Empty guid (#3429)
---
packages/empty/README.md | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/packages/empty/README.md b/packages/empty/README.md
index 56eb1844c..22c22b8a5 100644
--- a/packages/empty/README.md
+++ b/packages/empty/README.md
@@ -6,13 +6,16 @@
### 引入
-```js
-import Vue from 'vue';
-import { Empty } from 'vant';
+在`app.json`或`index.json`中引入组件,默认为`ES6`版本,`ES5`引入方式参见[快速上手](#/quickstart)
-Vue.use(Empty);
+```json
+"usingComponents": {
+ "van-empty": "@vant/weapp/empty/index"
+}
```
+> Vant Weapp 1.0 版本开始支持此组件,升级方式参见[快速上手](#/quickstart)
+
## 代码演示
### 基础用法
From 53e4f3bf89cbca6a795ef3edf98c23d0403b62af Mon Sep 17 00:00:00 2001
From: rex
Date: Fri, 31 Jul 2020 14:17:58 +0800
Subject: [PATCH 0362/1249] docs(tree-select): add doc for height (#3460)
---
example/project.config.json | 12 ++++++------
packages/tree-select/README.md | 2 ++
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/example/project.config.json b/example/project.config.json
index 1078db16c..9364efef7 100644
--- a/example/project.config.json
+++ b/example/project.config.json
@@ -6,6 +6,7 @@
"setting": {
"urlCheck": false,
"es6": true,
+ "enhance": false,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
@@ -15,20 +16,19 @@
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
+ "uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
+ "compileHotReLoad": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
- "useCompilerModule": false,
- "userConfirmedUseCompilerModuleSwitch": false,
- "enhance": false,
- "uglifyFileName": false,
- "compileHotReLoad": false,
- "useIsolateContext": true
+ "useIsolateContext": true,
+ "useCompilerModule": true,
+ "userConfirmedUseCompilerModuleSwitch": false
},
"compileType": "miniprogram",
"cloudfunctionRoot": "functions/",
diff --git a/packages/tree-select/README.md b/packages/tree-select/README.md
index 6bd3ddfba..ced21dbd0 100644
--- a/packages/tree-select/README.md
+++ b/packages/tree-select/README.md
@@ -94,6 +94,7 @@ Page({
```html
Date: Fri, 31 Jul 2020 18:58:04 +0800
Subject: [PATCH 0363/1249] refactor(Tag): update tag style (#3465)
---
example/pages/tag/index.wxml | 5 ----
packages/common/style/var.less | 13 +++++----
packages/tag/README.md | 22 +++++---------
packages/tag/index.less | 53 ++++++++++++++++++++--------------
packages/tag/index.wxml | 2 +-
5 files changed, 48 insertions(+), 47 deletions(-)
diff --git a/example/pages/tag/index.wxml b/example/pages/tag/index.wxml
index 430c466b5..49df62460 100644
--- a/example/pages/tag/index.wxml
+++ b/example/pages/tag/index.wxml
@@ -1,5 +1,4 @@
- 标签
标签
标签
标签
@@ -7,7 +6,6 @@
- 标签
标签
标签
标签
@@ -15,7 +13,6 @@
- 标签
标签
标签
标签
@@ -23,7 +20,6 @@
- 标签
标签
标签
标签
@@ -32,7 +28,6 @@
标签
- 标签
标签
标签
标签
标签
标签
标签
@@ -26,10 +25,9 @@
### 空心样式
-设置`plain`属性设置为空心样式
+设置 `plain` 属性设置为空心样式。
```html
-标签
标签
标签
标签
@@ -38,10 +36,9 @@
### 圆角样式
-通过`round`设置为圆角样式
+通过 `round` 设置为圆角样式。
```html
-标签
标签
标签
标签
@@ -50,10 +47,9 @@
### 标记样式
-通过`mark`设置为标记样式(半圆角)
+通过 `mark` 设置为标记样式(半圆角)。
```html
-标签
标签
标签
标签
@@ -64,7 +60,6 @@
```html
标签
-标签
标签
标签
标签
@@ -80,7 +75,7 @@
### 可关闭标签
-添加`closeable`属性表示标签是可关闭的,关闭标签时会触发`close`事件,在`close`事件中可以执行隐藏标签的逻辑
+添加 `closeable` 属性表示标签是可关闭的,关闭标签时会触发 `close` 事件,在 `close` 事件中可以执行隐藏标签的逻辑。
```html
From c3df9397c89a1cbaa02d7c22c8f214a977844684 Mon Sep 17 00:00:00 2001
From: rex
Date: Sat, 1 Aug 2020 09:59:08 +0800
Subject: [PATCH 0364/1249] fix(calendar): add toast in json (#3466)
fix #3320
---
packages/calendar/index.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/packages/calendar/index.json b/packages/calendar/index.json
index 61dec0864..397d5aea1 100644
--- a/packages/calendar/index.json
+++ b/packages/calendar/index.json
@@ -4,6 +4,7 @@
"header": "./components/header/index",
"month": "./components/month/index",
"van-button": "../button/index",
- "van-popup": "../popup/index"
+ "van-popup": "../popup/index",
+ "van-toast": "../toast/index"
}
}
From 2d47fb418f87c810ad4be347e50171ef09121d02 Mon Sep 17 00:00:00 2001
From: rex
Date: Sat, 1 Aug 2020 10:21:49 +0800
Subject: [PATCH 0365/1249] fix(tab): avoid swipe to disabled tab (#3467)
fix #3321
---
packages/tabs/index.ts | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/packages/tabs/index.ts b/packages/tabs/index.ts
index be97e1820..3a397b623 100644
--- a/packages/tabs/index.ts
+++ b/packages/tabs/index.ts
@@ -324,17 +324,39 @@ VantComponent({
onTouchEnd() {
if (!this.data.swipeable) return;
- const { tabs, currentIndex } = this.data;
const { direction, deltaX, offsetX } = this;
const minSwipeDistance = 50;
if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
- if (deltaX > 0 && currentIndex !== 0) {
- this.setCurrentIndex(currentIndex - 1);
- } else if (deltaX < 0 && currentIndex !== tabs.length - 1) {
- this.setCurrentIndex(currentIndex + 1);
+ const index = this.getAvaiableTab(deltaX);
+ if (index !== -1) {
+ this.setCurrentIndex(index);
}
}
+ },
+
+ getAvaiableTab(direction: number) {
+ const { tabs, currentIndex } = this.data;
+ const step = direction > 0 ? -1 : 1;
+
+ for (
+ let i = step;
+ currentIndex + i < tabs.length && currentIndex + i >= 0;
+ i += step
+ ) {
+ const index = currentIndex + i;
+
+ if (
+ index >= 0 &&
+ index < tabs.length &&
+ tabs[index] &&
+ !tabs[index].disabled
+ ) {
+ return index;
+ }
+ }
+
+ return -1;
}
}
});
From 31e85aeb6f7a51b422a56024bff76d25028ced34 Mon Sep 17 00:00:00 2001
From: zhongnan
Date: Mon, 3 Aug 2020 20:35:29 +0800
Subject: [PATCH 0366/1249] build: compile 1.4.2
---
dist/calendar/index.json | 3 ++-
dist/tabs/index.js | 28 +++++++++++++++++++++++-----
dist/tag/index.wxml | 2 +-
dist/tag/index.wxss | 2 +-
dist/toast/index.wxss | 2 +-
lib/calendar/index.json | 3 ++-
lib/tabs/index.js | 38 ++++++++++++++++++++++++++++----------
lib/tag/index.wxml | 2 +-
lib/tag/index.wxss | 2 +-
lib/toast/index.wxss | 2 +-
10 files changed, 61 insertions(+), 23 deletions(-)
diff --git a/dist/calendar/index.json b/dist/calendar/index.json
index 61dec0864..397d5aea1 100644
--- a/dist/calendar/index.json
+++ b/dist/calendar/index.json
@@ -4,6 +4,7 @@
"header": "./components/header/index",
"month": "./components/month/index",
"van-button": "../button/index",
- "van-popup": "../popup/index"
+ "van-popup": "../popup/index",
+ "van-toast": "../toast/index"
}
}
diff --git a/dist/tabs/index.js b/dist/tabs/index.js
index 6b73af7cd..bb6c9e10b 100644
--- a/dist/tabs/index.js
+++ b/dist/tabs/index.js
@@ -269,16 +269,34 @@ VantComponent({
// watch swipe touch end
onTouchEnd() {
if (!this.data.swipeable) return;
- const { tabs, currentIndex } = this.data;
const { direction, deltaX, offsetX } = this;
const minSwipeDistance = 50;
if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
- if (deltaX > 0 && currentIndex !== 0) {
- this.setCurrentIndex(currentIndex - 1);
- } else if (deltaX < 0 && currentIndex !== tabs.length - 1) {
- this.setCurrentIndex(currentIndex + 1);
+ const index = this.getAvaiableTab(deltaX);
+ if (index !== -1) {
+ this.setCurrentIndex(index);
+ }
+ }
+ },
+ getAvaiableTab(direction) {
+ const { tabs, currentIndex } = this.data;
+ const step = direction > 0 ? -1 : 1;
+ for (
+ let i = step;
+ currentIndex + i < tabs.length && currentIndex + i >= 0;
+ i += step
+ ) {
+ const index = currentIndex + i;
+ if (
+ index >= 0 &&
+ index < tabs.length &&
+ tabs[index] &&
+ !tabs[index].disabled
+ ) {
+ return index;
}
}
+ return -1;
},
},
});
diff --git a/dist/tag/index.wxml b/dist/tag/index.wxml
index 8c7868652..16ab75087 100644
--- a/dist/tag/index.wxml
+++ b/dist/tag/index.wxml
@@ -1,7 +1,7 @@
diff --git a/dist/tag/index.wxss b/dist/tag/index.wxss
index 0615a9935..46df0da04 100644
--- a/dist/tag/index.wxss
+++ b/dist/tag/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px}
\ No newline at end of file
+@import '../common/index.wxss';.van-tag{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;padding:0 4px;padding:var(--tag-padding,0 4px);color:#fff;color:var(--tag-text-color,#fff);font-size:12px;font-size:var(--tag-font-size,12px);line-height:16px;line-height:var(--tag-line-height,16px);border-radius:2px;border-radius:var(--tag-border-radius,2px)}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:inherit;content:"";pointer-events:none}.van-tag--medium{padding:2px 6px;padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{padding:4px 8px;padding:var(--tag-large-padding,4px 8px);font-size:14px;font-size:var(--tag-large-font-size,14px);border-radius:4px;border-radius:var(--tag-large-border-radius,4px)}.van-tag--mark{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--mark:after{display:block;width:2px;content:""}.van-tag--round{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{min-width:1em;margin-left:2px}
\ No newline at end of file
diff --git a/dist/toast/index.wxss b/dist/toast/index.wxss
index 2a98d2e29..85dc7a8fb 100644
--- a/dist/toast/index.wxss
+++ b/dist/toast/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
+@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(0,0,0,.7);background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:88px;width:var(--toast-default-width,88px);min-height:88px;min-height:var(--toast-default-min-height,88px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:36px;font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
diff --git a/lib/calendar/index.json b/lib/calendar/index.json
index 61dec0864..397d5aea1 100644
--- a/lib/calendar/index.json
+++ b/lib/calendar/index.json
@@ -4,6 +4,7 @@
"header": "./components/header/index",
"month": "./components/month/index",
"van-button": "../button/index",
- "van-popup": "../popup/index"
+ "van-popup": "../popup/index",
+ "van-toast": "../toast/index"
}
}
diff --git a/lib/tabs/index.js b/lib/tabs/index.js
index a2855c1b7..86d7486ff 100644
--- a/lib/tabs/index.js
+++ b/lib/tabs/index.js
@@ -309,21 +309,39 @@ component_1.VantComponent({
// watch swipe touch end
onTouchEnd: function () {
if (!this.data.swipeable) return;
+ var _a = this,
+ direction = _a.direction,
+ deltaX = _a.deltaX,
+ offsetX = _a.offsetX;
+ var minSwipeDistance = 50;
+ if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
+ var index = this.getAvaiableTab(deltaX);
+ if (index !== -1) {
+ this.setCurrentIndex(index);
+ }
+ }
+ },
+ getAvaiableTab: function (direction) {
var _a = this.data,
tabs = _a.tabs,
currentIndex = _a.currentIndex;
- var _b = this,
- direction = _b.direction,
- deltaX = _b.deltaX,
- offsetX = _b.offsetX;
- var minSwipeDistance = 50;
- if (direction === 'horizontal' && offsetX >= minSwipeDistance) {
- if (deltaX > 0 && currentIndex !== 0) {
- this.setCurrentIndex(currentIndex - 1);
- } else if (deltaX < 0 && currentIndex !== tabs.length - 1) {
- this.setCurrentIndex(currentIndex + 1);
+ var step = direction > 0 ? -1 : 1;
+ for (
+ var i = step;
+ currentIndex + i < tabs.length && currentIndex + i >= 0;
+ i += step
+ ) {
+ var index = currentIndex + i;
+ if (
+ index >= 0 &&
+ index < tabs.length &&
+ tabs[index] &&
+ !tabs[index].disabled
+ ) {
+ return index;
}
}
+ return -1;
},
},
});
diff --git a/lib/tag/index.wxml b/lib/tag/index.wxml
index 8c7868652..16ab75087 100644
--- a/lib/tag/index.wxml
+++ b/lib/tag/index.wxml
@@ -1,7 +1,7 @@
diff --git a/lib/tag/index.wxss b/lib/tag/index.wxss
index 0615a9935..46df0da04 100644
--- a/lib/tag/index.wxss
+++ b/lib/tag/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-tag{display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;line-height:normal;padding:.2em .5em;padding:var(--tag-padding,.2em .5em);color:#fff;color:var(--tag-text-color,#fff);font-size:10px;font-size:var(--tag-font-size,10px);border-radius:.2em;border-radius:var(--tag-border-radius,.2em)}.van-tag:after{border-color:currentColor;border-radius:.2em * 2;border-radius:var(--tag-border-radius,.2em) * 2}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--mark{padding-right:.7em}.van-tag--mark,.van-tag--mark:after{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--round,.van-tag--round:after{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag--medium{font-size:12px;font-size:var(--tag-medium-font-size,12px)}.van-tag--large{font-size:14px;font-size:var(--tag-large-font-size,14px)}.van-tag__close{margin-left:2px}
\ No newline at end of file
+@import '../common/index.wxss';.van-tag{position:relative;display:-webkit-inline-flex;display:inline-flex;-webkit-align-items:center;align-items:center;padding:0 4px;padding:var(--tag-padding,0 4px);color:#fff;color:var(--tag-text-color,#fff);font-size:12px;font-size:var(--tag-font-size,12px);line-height:16px;line-height:var(--tag-line-height,16px);border-radius:2px;border-radius:var(--tag-border-radius,2px)}.van-tag--default{background-color:#969799;background-color:var(--tag-default-color,#969799)}.van-tag--default.van-tag--plain{color:#969799;color:var(--tag-default-color,#969799)}.van-tag--danger{background-color:#ee0a24;background-color:var(--tag-danger-color,#ee0a24)}.van-tag--danger.van-tag--plain{color:#ee0a24;color:var(--tag-danger-color,#ee0a24)}.van-tag--primary{background-color:#1989fa;background-color:var(--tag-primary-color,#1989fa)}.van-tag--primary.van-tag--plain{color:#1989fa;color:var(--tag-primary-color,#1989fa)}.van-tag--success{background-color:#07c160;background-color:var(--tag-success-color,#07c160)}.van-tag--success.van-tag--plain{color:#07c160;color:var(--tag-success-color,#07c160)}.van-tag--warning{background-color:#ff976a;background-color:var(--tag-warning-color,#ff976a)}.van-tag--warning.van-tag--plain{color:#ff976a;color:var(--tag-warning-color,#ff976a)}.van-tag--plain{background-color:#fff;background-color:var(--tag-plain-background-color,#fff)}.van-tag--plain:before{position:absolute;top:0;right:0;bottom:0;left:0;border:1px solid;border-radius:inherit;content:"";pointer-events:none}.van-tag--medium{padding:2px 6px;padding:var(--tag-medium-padding,2px 6px)}.van-tag--large{padding:4px 8px;padding:var(--tag-large-padding,4px 8px);font-size:14px;font-size:var(--tag-large-font-size,14px);border-radius:4px;border-radius:var(--tag-large-border-radius,4px)}.van-tag--mark{border-radius:0 999px 999px 0;border-radius:0 var(--tag-round-border-radius,999px) var(--tag-round-border-radius,999px) 0}.van-tag--mark:after{display:block;width:2px;content:""}.van-tag--round{border-radius:999px;border-radius:var(--tag-round-border-radius,999px)}.van-tag__close{min-width:1em;margin-left:2px}
\ No newline at end of file
diff --git a/lib/toast/index.wxss b/lib/toast/index.wxss
index 2a98d2e29..85dc7a8fb 100644
--- a/lib/toast/index.wxss
+++ b/lib/toast/index.wxss
@@ -1 +1 @@
-@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(50,50,51,.88);background-color:var(--toast-background-color,rgba(50,50,51,.88));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:90px;width:var(--toast-default-width,90px);min-height:90px;min-height:var(--toast-default-min-height,90px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:48px;font-size:var(--toast-icon-size,48px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
+@import '../common/index.wxss';.van-toast{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;-webkit-align-items:center;align-items:center;-webkit-justify-content:center;justify-content:center;box-sizing:initial;color:#fff;color:var(--toast-text-color,#fff);font-size:14px;font-size:var(--toast-font-size,14px);line-height:20px;line-height:var(--toast-line-height,20px);white-space:pre-wrap;word-wrap:break-word;background-color:rgba(0,0,0,.7);background-color:var(--toast-background-color,rgba(0,0,0,.7));border-radius:8px;border-radius:var(--toast-border-radius,8px)}.van-toast__container{position:fixed;top:50%;left:50%;width:-webkit-fit-content;width:fit-content;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);max-width:70%;max-width:var(--toast-max-width,70%)}.van-toast--text{min-width:96px;min-width:var(--toast-text-min-width,96px);padding:8px 12px;padding:var(--toast-text-padding,8px 12px)}.van-toast--icon{width:88px;width:var(--toast-default-width,88px);min-height:88px;min-height:var(--toast-default-min-height,88px);padding:16px;padding:var(--toast-default-padding,16px)}.van-toast--icon .van-toast__icon{font-size:36px;font-size:var(--toast-icon-size,36px)}.van-toast--icon .van-toast__text{padding-top:8px}.van-toast__loading{margin:10px 0}.van-toast--top{-webkit-transform:translateY(-30vh);transform:translateY(-30vh)}.van-toast--bottom{-webkit-transform:translateY(30vh);transform:translateY(30vh)}
\ No newline at end of file
From e5e9b27ba4a7fce9ee0748b9f00da608b2343948 Mon Sep 17 00:00:00 2001
From: zhongnan
Date: Mon, 3 Aug 2020 20:35:34 +0800
Subject: [PATCH 0367/1249] build: release 1.4.2
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index 60733e536..ad889ee3e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@vant/weapp",
- "version": "1.4.1",
+ "version": "1.4.2",
"author": "youzan",
"license": "MIT",
"miniprogram": "lib",
From 842ca1a8b8540c04b9e0982e1c534d35ac881c3a Mon Sep 17 00:00:00 2001
From: rex
Date: Tue, 4 Aug 2020 16:02:12 +0800
Subject: [PATCH 0368/1249] feat(dialog): add new prop theme (#3476)
---
example/pages/dialog/index.js | 23 ++++++++++++++---
example/pages/dialog/index.wxml | 9 +++++++
packages/dialog/README.md | 29 ++++++++++++++++++++++
packages/dialog/dialog.ts | 20 ++++++++-------
packages/dialog/index.json | 4 ++-
packages/dialog/index.less | 5 ++++
packages/dialog/index.ts | 42 +++++++++++++++++--------------
packages/dialog/index.wxml | 44 ++++++++++++++++++++++++++++++++-
8 files changed, 142 insertions(+), 34 deletions(-)
diff --git a/example/pages/dialog/index.js b/example/pages/dialog/index.js
index 84558ebed..803a340f7 100644
--- a/example/pages/dialog/index.js
+++ b/example/pages/dialog/index.js
@@ -12,15 +12,30 @@ Page({
this.setData({ show: true });
},
- onClickAlert() {
+ getUserInfo(event) {
+ console.log(event.detail);
+ },
+
+ onClickThemeAlert() {
Dialog.alert({
title: '标题',
+ theme: 'round-button',
message
});
},
- getUserInfo(event) {
- console.log(event.detail);
+ onClickThemeAlert2() {
+ Dialog.alert({
+ theme: 'round-button',
+ message
+ });
+ },
+
+ onClickAlert() {
+ Dialog.alert({
+ title: '标题',
+ message
+ });
},
onClickAlert2() {
@@ -52,7 +67,7 @@ Page({
});
},
- onClose(event) {
+ onClose() {
this.setData({
show: false
});
diff --git a/example/pages/dialog/index.wxml b/example/pages/dialog/index.wxml
index a732282ff..beb07d006 100644
--- a/example/pages/dialog/index.wxml
+++ b/example/pages/dialog/index.wxml
@@ -7,6 +7,15 @@
+
+
+ 提示弹窗
+
+
+ 提示弹窗(无标题)
+
+
+
确认弹窗
diff --git a/packages/dialog/README.md b/packages/dialog/README.md
index 71156840b..e42bce50b 100644
--- a/packages/dialog/README.md
+++ b/packages/dialog/README.md
@@ -43,6 +43,33 @@ Dialog.alert({
});
```
+### 圆角样式
+
+样式为圆角风格。
+
+```html
+
+```
+
+```javascript
+import Dialog from 'path/to/@vant/weapp/dist/dialog/dialog';
+
+Dialog.alert({
+ title: '标题',
+ message: '弹窗内容',
+ theme: 'round-button',
+}).then(() => {
+ // on close
+});
+
+Dialog.alert({
+ message: '弹窗内容',
+ theme: 'round-button',
+}).then(() => {
+ // on close
+});
+```
+
### 消息确认
用于确认消息,包含取消和确认按钮
@@ -137,6 +164,7 @@ Page({
| title | 标题 | _string_ | - | - |
| width | 弹窗宽度,默认单位为`px` | _string \| number_ | `320px` | 1.0.0 |
| message | 文本内容,支持通过`\n`换行 | _string_ | - | 1.0.0 |
+| theme | 样式风格,可选值为`round-button` | _string_ | `default` |
| messageAlign | 内容对齐方式,可选值为`left` `right` | _string_ | `center` | - |
| zIndex | z-index 层级 | _number_ | `100` | - |
| className | 自定义类名,dialog 在自定义组件内时无效 | _string_ | '' | - |
@@ -179,6 +207,7 @@ Page({
| title | 标题 | _string_ | - |
| width | 弹窗宽度,默认单位为`px` | _string \| number_ | `320px` | 1.0.0 |
| message | 文本内容,支持通过`\n`换行 | _string_ | - |
+| theme | 样式风格,可选值为`round-button` | _string_ | `default` |
| message-align | 内容对齐方式,可选值为`left` `right` | _string_ | `center` |
| z-index | z-index 层级 | _number_ | `100` |
| class-name | 自定义类名,dialog 在自定义组件内时无效 | _string_ | '' |
diff --git a/packages/dialog/dialog.ts b/packages/dialog/dialog.ts
index 29603d53d..78eb2a85a 100644
--- a/packages/dialog/dialog.ts
+++ b/packages/dialog/dialog.ts
@@ -7,6 +7,7 @@ type DialogOptions = {
title?: string;
width?: string | number;
zIndex?: number;
+ theme?: string;
context?:
| WechatMiniprogram.Page.TrivialInstance
| WechatMiniprogram.Component.TrivialInstance;
@@ -53,10 +54,10 @@ function getContext() {
return pages[pages.length - 1];
}
-const Dialog: Dialog = (options) => {
+const Dialog: Dialog = options => {
options = {
...Dialog.currentOptions,
- ...options,
+ ...options
};
return new Promise((resolve, reject) => {
@@ -70,7 +71,7 @@ const Dialog: Dialog = (options) => {
dialog.setData({
onCancel: reject,
onConfirm: resolve,
- ...options,
+ ...options
});
wx.nextTick(() => {
@@ -90,6 +91,7 @@ Dialog.defaultOptions = {
show: false,
title: '',
width: null,
+ theme: 'default',
message: '',
zIndex: 100,
overlay: true,
@@ -105,31 +107,31 @@ Dialog.defaultOptions = {
showConfirmButton: true,
showCancelButton: false,
closeOnClickOverlay: false,
- confirmButtonOpenType: '',
+ confirmButtonOpenType: ''
};
Dialog.alert = Dialog;
-Dialog.confirm = (options) =>
+Dialog.confirm = options =>
Dialog({
showCancelButton: true,
- ...options,
+ ...options
});
Dialog.close = () => {
- queue.forEach((dialog) => {
+ queue.forEach(dialog => {
dialog.close();
});
queue = [];
};
Dialog.stopLoading = () => {
- queue.forEach((dialog) => {
+ queue.forEach(dialog => {
dialog.stopLoading();
});
};
-Dialog.setDefaultOptions = (options) => {
+Dialog.setDefaultOptions = options => {
Object.assign(Dialog.currentOptions, options);
};
diff --git a/packages/dialog/index.json b/packages/dialog/index.json
index e2ee09ae8..1b87cc897 100644
--- a/packages/dialog/index.json
+++ b/packages/dialog/index.json
@@ -2,6 +2,8 @@
"component": true,
"usingComponents": {
"van-popup": "../popup/index",
- "van-button": "../button/index"
+ "van-button": "../button/index",
+ "van-goods-action": "../goods-action//index",
+ "van-goods-action-button": "../goods-action-button/index"
}
}
diff --git a/packages/dialog/index.less b/packages/dialog/index.less
index a66b01079..bcd9a57b3 100644
--- a/packages/dialog/index.less
+++ b/packages/dialog/index.less
@@ -53,6 +53,11 @@
&__footer {
display: flex;
+
+ &--round {
+ position: relative !important;
+ padding: 0 @padding-lg - 5px @padding-md !important;
+ }
}
&__button {
diff --git a/packages/dialog/index.ts b/packages/dialog/index.ts
index 6782c79b2..7240ed22e 100644
--- a/packages/dialog/index.ts
+++ b/packages/dialog/index.ts
@@ -1,7 +1,7 @@
import { VantComponent } from '../common/component';
import { button } from '../mixins/button';
import { openType } from '../mixins/open-type';
-import { GRAY, BLUE } from '../common/color';
+import { GRAY, RED } from '../common/color';
type Action = 'confirm' | 'cancel' | 'overlay';
@@ -13,10 +13,14 @@ VantComponent({
type: Boolean,
observer(show: boolean) {
!show && this.stopLoading();
- },
+ }
},
title: String,
message: String,
+ theme: {
+ type: String,
+ value: 'default'
+ },
useSlot: Boolean,
className: String,
customStyle: String,
@@ -30,43 +34,43 @@ VantComponent({
width: null,
zIndex: {
type: Number,
- value: 2000,
+ value: 2000
},
confirmButtonText: {
type: String,
- value: '确认',
+ value: '确认'
},
cancelButtonText: {
type: String,
- value: '取消',
+ value: '取消'
},
confirmButtonColor: {
type: String,
- value: BLUE,
+ value: RED
},
cancelButtonColor: {
type: String,
- value: GRAY,
+ value: GRAY
},
showConfirmButton: {
type: Boolean,
- value: true,
+ value: true
},
overlay: {
type: Boolean,
- value: true,
+ value: true
},
transition: {
type: String,
- value: 'scale',
- },
+ value: 'scale'
+ }
},
data: {
loading: {
confirm: false,
- cancel: false,
- },
+ cancel: false
+ }
},
methods: {
@@ -85,7 +89,7 @@ VantComponent({
handleAction(action: Action) {
if (this.data.asyncClose) {
this.setData({
- [`loading.${action}`]: true,
+ [`loading.${action}`]: true
});
}
@@ -94,7 +98,7 @@ VantComponent({
close() {
this.setData({
- show: false,
+ show: false
});
},
@@ -102,8 +106,8 @@ VantComponent({
this.setData({
loading: {
confirm: false,
- cancel: false,
- },
+ cancel: false
+ }
});
},
@@ -122,6 +126,6 @@ VantComponent({
if (callback) {
callback(this);
}
- },
- },
+ }
+ }
});
diff --git a/packages/dialog/index.wxml b/packages/dialog/index.wxml
index cbad7f6f3..bcec2742a 100644
--- a/packages/dialog/index.wxml
+++ b/packages/dialog/index.wxml
@@ -27,7 +27,49 @@
{{ message }}
-