diff --git a/packages/submit-bar/index.js b/packages/submit-bar/index.js new file mode 100644 index 000000000..e3e6639d9 --- /dev/null +++ b/packages/submit-bar/index.js @@ -0,0 +1,63 @@ +import { use } from '../utils'; +import Button from '../button'; + +const [sfc, bem, t] = use('submit-bar'); + +export default sfc({ + props: { + tip: String, + label: String, + loading: Boolean, + disabled: Boolean, + buttonText: String, + price: { + type: Number, + default: null + }, + currency: { + type: String, + default: '¥' + }, + buttonType: { + type: String, + default: 'danger' + } + }, + + render(h) { + const { tip, price, $slots } = this; + const hasPrice = typeof price === 'number'; + + return ( +
+ {$slots.top} + {($slots.tip || tip) && ( +
+ {tip} + {$slots.tip} +
+ )} +
+ {$slots.default} +
+ {hasPrice && [ + {this.label || t('label')}, + {`${this.currency} ${(price / 100).toFixed(2)}`} + ]} +
+
+
+ ); + } +}); diff --git a/packages/submit-bar/index.vue b/packages/submit-bar/index.vue deleted file mode 100644 index 21256d33d..000000000 --- a/packages/submit-bar/index.vue +++ /dev/null @@ -1,74 +0,0 @@ - - - diff --git a/packages/submit-bar/test/__snapshots__/demo.spec.js.snap b/packages/submit-bar/test/__snapshots__/demo.spec.js.snap index 17086b5c1..c73a59f37 100644 --- a/packages/submit-bar/test/__snapshots__/demo.spec.js.snap +++ b/packages/submit-bar/test/__snapshots__/demo.spec.js.snap @@ -4,26 +4,23 @@ exports[`renders demo correctly 1`] = `
-
-
合计: ¥ 30.50
+
合计:¥ 30.50
-
- 你的收货地址不支持同城送, 我们已为你推荐快递
+
你的收货地址不支持同城送, 我们已为你推荐快递
-
合计: ¥ 30.50
+
合计:¥ 30.50
-
-
合计: ¥ 30.50
@@ -31,8 +28,7 @@ exports[`renders demo correctly 1`] = `
-
- +
你的收货地址不支持同城送, 修改地址 @@ -42,7 +38,7 @@ exports[`renders demo correctly 1`] = `
全选
-
合计: ¥ 30.50
+
合计:¥ 30.50
diff --git a/packages/submit-bar/test/__snapshots__/index.spec.js.snap b/packages/submit-bar/test/__snapshots__/index.spec.js.snap index d788eba37..f0acf4f87 100644 --- a/packages/submit-bar/test/__snapshots__/index.spec.js.snap +++ b/packages/submit-bar/test/__snapshots__/index.spec.js.snap @@ -2,9 +2,8 @@ exports[`submit 1`] = `
-
-
合计: ¥ 0.00
+
合计:¥ 0.00
`;