@@ -54,7 +63,8 @@ export default {
buttonRight: '右侧弹出',
getContainer: '指定挂载节点',
roundCorner: '圆角弹窗',
- closeIcon: '关闭图标'
+ closeIcon: '关闭图标',
+ customCloseIcon: '自定义图标'
},
'en-US': {
position: 'Position',
@@ -65,7 +75,8 @@ export default {
buttonRight: 'From Right',
getContainer: 'Get Container',
roundCorner: 'Round Corner',
- closeIcon: 'Close Icon'
+ closeIcon: 'Close Icon',
+ customCloseIcon: 'Custom Icon'
}
},
@@ -78,7 +89,8 @@ export default {
showRight: false,
showCloseIcon: false,
showRoundCorner: false,
- showGetContainer: false
+ showGetContainer: false,
+ showCustomCloseIcon: false,
};
}
};
diff --git a/src/popup/index.js b/src/popup/index.js
index f26db4340..a9fec90a5 100644
--- a/src/popup/index.js
+++ b/src/popup/index.js
@@ -12,6 +12,10 @@ export default createComponent({
duration: Number,
closeable: Boolean,
transition: String,
+ closeIcon: {
+ type: String,
+ default: 'cross'
+ },
position: {
type: String,
default: 'center'
@@ -64,7 +68,7 @@ export default createComponent({
>
{this.slots()}
{this.closeable && (
-
+
)}
diff --git a/src/popup/index.less b/src/popup/index.less
index 13995a8b6..df59172e7 100644
--- a/src/popup/index.less
+++ b/src/popup/index.less
@@ -89,6 +89,10 @@
right: @popup-close-icon-margin;
color: @popup-close-icon-color;
font-size: @popup-close-icon-size;
+
+ &:active {
+ opacity: .6;
+ }
}
}
}
diff --git a/src/popup/test/__snapshots__/demo.spec.js.snap b/src/popup/test/__snapshots__/demo.spec.js.snap
index 55c79d4bc..aca9c0583 100644
--- a/src/popup/test/__snapshots__/demo.spec.js.snap
+++ b/src/popup/test/__snapshots__/demo.spec.js.snap
@@ -14,6 +14,7 @@ exports[`renders demo correctly 1`] = `
+
diff --git a/src/popup/test/__snapshots__/index.spec.js.snap b/src/popup/test/__snapshots__/index.spec.js.snap
index 6fd203565..3f831d084 100644
--- a/src/popup/test/__snapshots__/index.spec.js.snap
+++ b/src/popup/test/__snapshots__/index.spec.js.snap
@@ -1,5 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
+exports[`close-icon prop 1`] = `
+
+`;
+
exports[`duration prop 1`] = ``;
exports[`reset z-index 1`] = ``;
diff --git a/src/popup/test/index.spec.js b/src/popup/test/index.spec.js
index 25a015174..a5879e9e8 100644
--- a/src/popup/test/index.spec.js
+++ b/src/popup/test/index.spec.js
@@ -239,3 +239,15 @@ test('closeable prop', () => {
wrapper.find('.van-popup__close-icon').trigger('click');
expect(wrapper.emitted('input')[0][0]).toEqual(false);
});
+
+test('close-icon prop', () => {
+ const wrapper = mount(Popup, {
+ propsData: {
+ value: true,
+ closeable: true,
+ closeIcon: 'success'
+ }
+ });
+
+ expect(wrapper).toMatchSnapshot();
+});