Popover: compatible with 2.6 new v-slot syntax (#20424)

pull/20427/head
iamkun 2020-11-11 16:48:10 +08:00 committed by GitHub
parent c71ab0a127
commit 985bd49fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -18,8 +18,10 @@
<slot>{{ content }}</slot> <slot>{{ content }}</slot>
</div> </div>
</transition> </transition>
<span class="el-popover__reference-wrapper" ref="wrapper" >
<slot name="reference"></slot> <slot name="reference"></slot>
</span> </span>
</span>
</template> </template>
<script> <script>
import Popper from 'element-ui/src/utils/vue-popper'; import Popper from 'element-ui/src/utils/vue-popper';
@ -87,8 +89,8 @@ export default {
let reference = this.referenceElm = this.reference || this.$refs.reference; let reference = this.referenceElm = this.reference || this.$refs.reference;
const popper = this.popper || this.$refs.popper; const popper = this.popper || this.$refs.popper;
if (!reference && this.$slots.reference && this.$slots.reference[0]) { if (!reference && this.$refs.wrapper.children) {
reference = this.referenceElm = this.$slots.reference[0].elm; reference = this.referenceElm = this.$refs.wrapper.children[0];
} }
// 访 // 访
if (reference) { if (reference) {
@ -192,8 +194,8 @@ export default {
let reference = this.reference || this.$refs.reference; let reference = this.reference || this.$refs.reference;
const popper = this.popper || this.$refs.popper; const popper = this.popper || this.$refs.popper;
if (!reference && this.$slots.reference && this.$slots.reference[0]) { if (!reference && this.$refs.wrapper.children) {
reference = this.referenceElm = this.$slots.reference[0].elm; reference = this.referenceElm = this.$refs.wrapper.children[0];
} }
if (!this.$el || if (!this.$el ||
!reference || !reference ||