Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can the text of the <el-switch> switch component be inside the button? #16940

Closed
941477276 opened this issue Aug 7, 2019 · 4 comments
Closed

Comments

@941477276
Copy link

941477276 commented Aug 7, 2019

Existing Component

Component Name

<el-switch>

Description

目前开关组件的active-text、inactive-text是在开关的两侧显示的,这在比较紧凑的布局页面中是无法实现与UI设计稿一致的。所以希望开关组件的active-text、inactive-text能放到开关里面去,如下图
image

@element-bot element-bot changed the title [Feature Request] <el-switch>开关组件的文字可以在按钮内部吗? Can the text of the <el-switch> switch component be inside the button? Aug 7, 2019
@element-bot
Copy link
Member

Translation of this issue:

Existing Component

yes

Component Name

Description

At present, the active-text and inactive-text of switch components are displayed on both sides of the switch, which can not be consistent with the UI design draft in a compact layout page. So I hope that the active-text and inactive-text of switch components can be put into the switch, as shown below.

image

@ziyoung
Copy link
Contributor

ziyoung commented Sep 3, 2019

Sorry, we have no plan to support this.

@ziyoung ziyoung closed this as completed Sep 3, 2019
@cloydlau
Copy link

cloydlau commented Aug 7, 2021

This will do it:

<template>
  <PopSwitch
    active-text="上架"
    inactive-text="下架"
  />
</template>

<script>
// install 'kikimore' first
import { PopSwitch } from 'kikimore'

export default {
  components: { PopSwitch }
}
</script>

Width is self-adapting, document here

@wuliupo
Copy link

wuliupo commented Sep 10, 2021

在 1.x 支持这个功能,element-ui 2.x 和 element-plux 3.x 去掉了 @941477276
https://element.eleme.cn/1.4/#/zh-CN/component/switch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants