From d922c2baaa581ebb0b364adaa37bd3de4eec2a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=88=E5=85=89=E5=80=BE=E5=9F=8E?= Date: Tue, 28 Jul 2020 10:59:30 +0800 Subject: [PATCH] feat(ShareSheet): add className option (#6886) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: van-share-sheet支持设置分享选项的类名 * Update README.zh-CN.md * Update README.md * Update index.vue * fix: 添加一些van-share-sheet测试用例 * fix: change van-share-sheet test code Co-authored-by: neverland <416417567@163.com> --- src/share-sheet/README.md | 1 + src/share-sheet/README.zh-CN.md | 1 + src/share-sheet/index.js | 2 +- src/share-sheet/test/index.spec.js | 13 +++++++++++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/share-sheet/README.md b/src/share-sheet/README.md index ec78dec72..f6d0c9dcb 100644 --- a/src/share-sheet/README.md +++ b/src/share-sheet/README.md @@ -130,6 +130,7 @@ export default { | name | Option name | _string_ | | description `v2.8.5` | Option description | _string_ | | icon | Option icon,can be set to `wechat` `weibo` `qq` `link` `qrcode` `poster` or image URL | _string_ | +| className | Option className is used to set the class props to the share item | _string_ | ### Events diff --git a/src/share-sheet/README.zh-CN.md b/src/share-sheet/README.zh-CN.md index 2b14c5b8f..b0338876c 100644 --- a/src/share-sheet/README.zh-CN.md +++ b/src/share-sheet/README.zh-CN.md @@ -178,6 +178,7 @@ export default { | name | 分享渠道名称 | _string_ | | description `v2.8.5` | 分享选项描述 | _string_ | | icon | 图标,可选值为 `wechat` `weibo` `qq` `link` `qrcode` `poster`,支持传入图片 URL | _string_ | +| className | 分享选项类名 | _string_ | ### Events diff --git a/src/share-sheet/index.js b/src/share-sheet/index.js index 9dde4c5c4..744ca0ae7 100644 --- a/src/share-sheet/index.js +++ b/src/share-sheet/index.js @@ -85,7 +85,7 @@ export default createComponent({
{ this.onSelect(option, index); }} diff --git a/src/share-sheet/test/index.spec.js b/src/share-sheet/test/index.spec.js index 7089c702e..d4a3a87bd 100644 --- a/src/share-sheet/test/index.spec.js +++ b/src/share-sheet/test/index.spec.js @@ -29,6 +29,19 @@ test('description prop', () => { expect(wrapper.contains('.van-share-sheet__description')).toBeFalsy(); }); +test('option className', () => { + const wrapper = mount(ShareSheet, { + propsData: { + value: true, + options: [{ name: 'Link', icon: 'link', className: 'foo' }], + }, + }); + + const option = wrapper.find('.van-share-sheet__option').element; + + expect(option.className.includes('foo')).toBeTruthy(); +}); + test('select event', () => { const wrapper = mount(ShareSheet, { propsData: {