From b74fe6fffc099aca85cb7271a622b9677abed19c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E6=B6=B5?= Date: Thu, 14 Feb 2019 20:16:11 +0800 Subject: [PATCH] fix template slot --- packages/field/index.js | 13 +++++++++---- packages/search/index.js | 7 ++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/packages/field/index.js b/packages/field/index.js index 7701f5fc5..74be91bd1 100644 --- a/packages/field/index.js +++ b/packages/field/index.js @@ -211,6 +211,14 @@ export default sfc({ render(h) { const { slots, labelAlign } = this; + + const scopedSlots = { + icon: this.renderLeftIcon + }; + if (slots('label')) { + scopedSlots.label = () => slots('title'); + } + return ( - {h('template', { slot: 'title' }, slots('label'))}
{this.renderInput()} {this.showClear && } diff --git a/packages/search/index.js b/packages/search/index.js index c190aeefe..1d15a8f32 100644 --- a/packages/search/index.js +++ b/packages/search/index.js @@ -53,6 +53,11 @@ export default sfc({ on: this.listeners }; + const scopedSlots = {}; + if (this.slots('left-icon')) { + scopedSlots['left-icon'] = () => this.slots('left-icon'); + } + return (
- {h('template', { slot: 'left-icon' }, this.slots('left-icon'))} {showAction && (