element-plus/docs/examples/switch/text-description.vue
Carter Li 1aa9d43129
refactor(components): [switch] Simplify color handling (#8199)
1. Use CSS variables to set `(in)activeColor` in order not to modify DOM
2. Deprecate property `(in)activeColor` in favor of CSS variables
2022-06-12 22:40:53 +08:00

41 lines
809 B
Vue

<template>
<el-switch
v-model="value1"
class="mb-2"
active-text="Pay by month"
inactive-text="Pay by year"
/>
<br />
<el-switch
v-model="value2"
class="mb-2"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
active-text="Pay by month"
inactive-text="Pay by year"
/>
<br />
<el-switch
v-model="value3"
inline-prompt
active-text=""
inactive-text=""
/>
<el-switch
v-model="value4"
class="ml-2"
inline-prompt
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949"
active-text="Y"
inactive-text="N"
/>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
const value1 = ref(true)
const value2 = ref(true)
const value3 = ref(true)
const value4 = ref(true)
</script>