Skip to content

feat: 为 el-select 添加 extra 插槽#66

Merged
levy9527 merged 5 commits intoFEMessage:devfrom
zhn4:feat/el-select
Aug 10, 2020
Merged

feat: 为 el-select 添加 extra 插槽#66
levy9527 merged 5 commits intoFEMessage:devfrom
zhn4:feat/el-select

Conversation

@zhn4
Copy link
Copy Markdown

@zhn4 zhn4 commented Aug 7, 2020

Why

如图所示,用户选择成员后,去点击右上角的“成员管理”按钮,浏览器打开一个新的标签页修改成员,修改完后关闭标签页
然后回到这个页面,点击选择列表的“刷新成员列表”按钮,刷新成员列表
image

How

选项列表下插入一个插槽

<el-select-menu
        ref="popper"
        :append-to-body="popperAppendToBody"
        v-show="visible && emptyText !== false">
        <el-scrollbar
          tag="ul"
          wrap-class="el-select-dropdown__wrap"
          view-class="el-select-dropdown__list"
          ref="scrollbar"
          :class="{ 'is-empty': !allowCreate && query && filteredOptionsCount === 0 }"
          v-show="options.length > 0 && !loading">
          <el-option
            :value="query"
            created
            v-if="showNewOption">
          </el-option>
          <slot></slot>
        </el-scrollbar>
        <template v-if="$slots.extra">
          <slot name="extra"></slot>
        </template>
        <template v-if="emptyText && (!allowCreate || loading || (allowCreate && options.length === 0 ))">
          <slot name="empty" v-if="$slots.empty"></slot>
          <p class="el-select-dropdown__empty" v-else>
            {{ emptyText }}
          </p>
        </template>

@netlify
Copy link
Copy Markdown

netlify bot commented Aug 7, 2020

Deploy preview for femessage-element ready!

Built with commit b25309a

https://deploy-preview-66--femessage-element.netlify.app

@levy9527
Copy link
Copy Markdown

levy9527 commented Aug 9, 2020

在文档里补充个示例吧,让其他人可以看到在线的demo,方便学习如何使用。

@levy9527 levy9527 changed the title Feat/el select feat: 为el-select 添加 extra 插槽 Aug 10, 2020
@auto-add-label auto-add-label bot added the enhancement New feature or request label Aug 10, 2020
@levy9527 levy9527 changed the title feat: 为el-select 添加 extra 插槽 feat: 为 el-select 添加 extra 插槽 Aug 10, 2020
Comment thread examples/docs/zh-CN/select.md Outdated
Comment on lines +533 to +535
        <el-button type="text" @click="handleRefresh">
          刷新城市列表
        </el-button>
Copy link
Copy Markdown

@eviIIt eviIIt Aug 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

虽然是 demo,但还是让这个按钮居中会好看一点

如图:
image

@levy9527 levy9527 merged commit d6c99ae into FEMessage:dev Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants