Merge branch 'dev' into next

This commit is contained in:
chenjiahan 2020-09-13 09:40:27 +08:00
commit 644ab9f7d0
13 changed files with 63 additions and 29 deletions

View File

@ -2266,9 +2266,9 @@ nice-try@^1.0.4:
integrity sha1-ozeKdpbOfSI+iPybdkvX7xCJ42Y=
node-fetch@^2.3.0:
version "2.6.0"
resolved "https://registry.npm.taobao.org/node-fetch/download/node-fetch-2.6.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fnode-fetch%2Fdownload%2Fnode-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha1-5jNFY4bUqlWGP2dqerDaqP3ssP0=
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
normalize-package-data@^2.5.0:
version "2.5.0"

View File

@ -4232,7 +4232,7 @@ debug@4, debug@4.1.1, debug@^4.0.0, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1:
dependencies:
ms "^2.1.1"
debug@^3.0.0, debug@^3.1.1, debug@^3.2.5:
debug@^3.1.1, debug@^3.2.5:
version "3.2.6"
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b"
integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==
@ -5002,9 +5002,9 @@ etag@~1.8.1:
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
eventemitter3@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb"
integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg==
version "4.0.7"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==
events@^3.0.0:
version "3.1.0"
@ -5465,11 +5465,9 @@ flush-write-stream@^1.0.0:
readable-stream "^2.3.6"
follow-redirects@^1.0.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.10.0.tgz#01f5263aee921c6a54fb91667f08f4155ce169eb"
integrity sha512-4eyLK6s6lH32nOvLLwlIOnr9zrL8Sm+OvW4pVTJNoXeGzYIkHVf+pADQi+OJ0E67hiuSLezPVPyBcIZO50TmmQ==
dependencies:
debug "^3.0.0"
version "1.13.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.0.tgz#b42e8d93a2a7eea5ed88633676d6597bc8e384db"
integrity sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==
for-in@^1.0.2:
version "1.0.2"
@ -6177,9 +6175,9 @@ http-proxy-middleware@0.19.1:
micromatch "^3.1.10"
http-proxy@^1.17.0:
version "1.18.0"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a"
integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==
version "1.18.1"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.1.tgz#401541f0534884bbf95260334e72f88ee3976549"
integrity sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==
dependencies:
eventemitter3 "^4.0.0"
follow-redirects "^1.0.0"
@ -8430,9 +8428,9 @@ no-case@^3.0.3:
tslib "^1.10.0"
node-fetch@^2.2.0, node-fetch@^2.3.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
node-forge@0.9.0:
version "0.9.0"

View File

@ -3266,9 +3266,9 @@ nice-try@^1.0.4:
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==
node-fetch@^2.3.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
node-gyp@^4.0.0:
version "4.0.0"

View File

@ -112,6 +112,7 @@ app.use(Button);
| color | Color, support linear-gradient | _string_ | - |
| icon | Left Icon | _string_ | - |
| icon-prefix `v2.6.0` | Icon className prefix | _string_ | `van-icon` |
| icon-position `v2.10.7` | Icon position, can be set to `right` | `left` |
| tag | HTML Tag | _string_ | `button` |
| native-type | Native Type Attribute | _string_ | `''` |
| plain | Whether to be plain button | _boolean_ | `false` |

View File

@ -134,7 +134,8 @@ app.use(Button);
| color | 按钮颜色,支持传入`linear-gradient`渐变色 | _string_ | - |
| icon | 左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
| icon-prefix `v2.6.0` | 图标类名前缀,同 Icon 组件的 [class-prefix 属性](#/zh-CN/icon#props) | _string_ | `van-icon` |
| tag | 根节点的 HTML 标签 | _string_ | `button` |
| icon-position `v2.10.7` | 图标展示位置,可选值为 `right` | `left` |
| tag | 按钮根节点的 HTML 标签 | _string_ | `button` |
| native-type | 原生 button 标签的 type 属性 | _string_ | - |
| block | 是否为块级元素 | _boolean_ | `false` |
| plain | 是否为朴素按钮 | _boolean_ | `false` |

View File

@ -42,6 +42,10 @@ export default createComponent({
type: String,
default: '20px',
},
iconPosition: {
type: String,
default: 'left',
},
},
emits: ['click'],
@ -136,6 +140,7 @@ export default createComponent({
disabled,
hairline,
nativeType,
iconPosition,
} = props;
const classes = [
@ -164,8 +169,9 @@ export default createComponent({
onClick={onClick}
>
<div class={bem('content')}>
{renderIcon()}
{iconPosition === 'left' && renderIcon()}
{renderText()}
{iconPosition === 'right' && renderIcon()}
</div>
</tag>
);

View File

@ -160,8 +160,10 @@
}
&__icon + &__text,
&__loading + &__text {
margin-left: 5px;
&__loading + &__text,
&__text + &__icon,
&__text + &__loading {
margin-left: @padding-base;
}
&--hairline {

View File

@ -1,5 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`icon-position prop 1`] = `
<button class="van-button van-button--default van-button--normal">
<div class="van-button__content"><i class="van-icon van-icon-plus van-button__icon">
<!----></i></div>
</button>
`;
exports[`icon-prefix prop 1`] = `
<button class="van-button van-button--default van-button--normal">
<div class="van-button__content"><i class="my-icon my-icon-success van-button__icon">

View File

@ -11,6 +11,16 @@ test('loading-size prop', () => {
expect(wrapper).toMatchSnapshot();
});
test('icon-position prop', () => {
const wrapper = mount(Button, {
propsData: {
icon: 'plus',
iconPosition: 'right',
},
});
expect(wrapper).toMatchSnapshot();
});
test('click event', () => {
const onClick = jest.fn();
const wrapper = mount(Button, {

View File

@ -2,6 +2,7 @@ import { ref, reactive, nextTick, onActivated, watch } from 'vue';
import { createNamespace, isDef } from '../utils';
import { doubleRaf } from '../utils/dom/raf';
import { useRect } from '../composition/use-rect';
import { useEventListener } from '@vant/use';
import Icon from '../icon';
const [createComponent, bem] = createNamespace('notice-bar');
@ -33,6 +34,7 @@ export default createComponent({
setup(props, { emit, slots }) {
let wrapWidth = 0;
let contentWidth = 0;
let startTimer;
const wrapRef = ref();
const contentRef = ref();
@ -134,7 +136,8 @@ export default createComponent({
reset();
setTimeout(() => {
clearTimeout(startTimer);
startTimer = setTimeout(() => {
if (!wrapRef.value || !contentRef.value || scrollable === false) {
return;
}
@ -155,6 +158,10 @@ export default createComponent({
onActivated(start);
// fix cache issues with forwards and back history in safari
// see: https://guwii.com/cache-issues-with-forwards-and-back-history-in-safari/
useEventListener('pageshow', start);
watch([() => props.text, () => props.scrollable], start, {
immediate: true,
});

View File

@ -754,6 +754,7 @@
@tabbar-item-font-size: @font-size-sm;
@tabbar-item-text-color: @gray-7;
@tabbar-item-active-color: @blue;
@tabbar-item-active-background-color: @tabbar-background-color;
@tabbar-item-line-height: 1;
@tabbar-item-icon-size: 22px;
@tabbar-item-margin-bottom: 4px;

View File

@ -29,6 +29,7 @@
&--active {
color: @tabbar-item-active-color;
background-color: @tabbar-item-active-background-color;
}
.van-badge {

View File

@ -8607,9 +8607,9 @@ no-case@^3.0.3:
tslib "^1.10.0"
node-fetch@^2.2.0, node-fetch@^2.3.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
node-forge@0.9.0:
version "0.9.0"