From 1ca52791938272910413a83a3fed4ce56d0b1be7 Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 18 Aug 2020 17:36:21 +0800 Subject: [PATCH] chore(AddressEdit): remove SwitchCell (#7015) --- src/address-edit/index.js | 45 +++++++++++++------ .../test/__snapshots__/demo.spec.js.snap | 8 ++-- .../test/__snapshots__/index.spec.js.snap | 32 +++++-------- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/src/address-edit/index.js b/src/address-edit/index.js index ea24c2f07..ba0b117b4 100644 --- a/src/address-edit/index.js +++ b/src/address-edit/index.js @@ -4,13 +4,14 @@ import { isMobile } from '../utils/validate/mobile'; // Components import Area from '../area'; +import Cell from '../cell'; import Field from '../field'; import Popup from '../popup'; import Toast from '../toast'; import Button from '../button'; import Dialog from '../dialog'; import Detail from './Detail'; -import SwitchCell from '../switch-cell'; +import Switch from '../switch'; const [createComponent, bem, t] = createNamespace('address-edit'); @@ -258,6 +259,34 @@ export default createComponent({ this.detailFocused = false; }); }, + + genSetDefaultCell(h) { + if (this.showSetDefault) { + const slots = { + 'right-icon': () => ( + { + this.$emit('change-default', event); + }} + /> + ), + }; + + return ( + + ); + } + + return h(); + }, }, render(h) { @@ -334,19 +363,7 @@ export default createComponent({ )} {this.slots()} - {this.showSetDefault ? ( - { - this.$emit('change-default', event); - }} - /> - ) : ( - h() - )} + {this.genSetDefaultCell(h)}
-
+
设为默认收货地址
-
-
-
-
+
+
-
+
设为默认收货地址
-
-
-
-
+
+
-
+
设为默认收货地址
-
-
-
-
+
+
-
+
设为默认收货地址
-
-
-
-
+
+
-
+
设为默认收货地址
-
-
-
-
+
+