当前位置:网站首页>自己封裝的風格化的開關卡片組件
自己封裝的風格化的開關卡片組件
2022-07-19 01:30:00 【TaitChan】
效果圖:
代碼:
<template>
<div class="card" :class="isOpen?type:'off'">
<el-row style="position:relative">
<i :class="icon" style="font-size: 40px;font-weight: 100" />
<div style="position: absolute;top: 0;right: 0;padding-top: 10px">
<ct-switch
v-model="isOpen"
:circle-color="isOpen?activeColors[type]:'#fff'"
active-color="#FDFDFD"
inactive-color="#8A88B7"
active-text="ON"
inactive-text="OFF"
/>
</div>
</el-row>
<el-row style="height: 40px;position: relative">
<span style="font-size: 16px;font-weight: 600;position: absolute;bottom: 0;left:0;letter-spacing: 1px">{
{
name }}</span>
</el-row>
</div>
</template>
<script>
import CtSwitch from './ct-switch'
export default {
name: 'CtCard',
components: {
CtSwitch },
props: {
type: {
type: String,
default: 'off'
},
icon: {
type: String,
default: 'el-icon-coffee-cup'
},
name: {
type: String,
default: 'taitChan'
}
},
data() {
return {
isOpen: true,
activeColors: {
success: '#2BAA5D', danger: '#F2946D', primary: '#0077F4', warning: '#7230F9' }
}
}
}
</script>
<style scoped>
.card{
border-radius: 20px;
width: 200px;
height: 120px;
margin: 0 20px 20px 0;
display: inline-block;
padding: 20px;
color: white;
}
.success{
background-image: linear-gradient(to bottom right, #33C8B4, #2CAD66);
}
.primary{
background-color: #0082F6;
}
.danger{
background-image: linear-gradient(to right, #FA7D74 , #F94E39);
}
.warning{
background-color: #7A40F2;
}
.off{
box-shadow: 0 0 20px rgba(138, 136, 183,0.8);
}
</style>
開關部分(ct-switch)是由這個改的,改的比較粗糙。
边栏推荐
猜你喜欢

Oracle automatic storage management 18C step-by-step installation -1

小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId

tp-watermark.js网页添加水印插件

JSX 语法

服务器如何安装宝塔面板?(宝塔面板安装教程)

cmake的基本使用

uniapp中text-indent不起作用,uniapp首行缩进不管用如何解决?
![Eye of depth III - (3)] mathematics: matrix eigenvalue and eigenvector 1](/img/81/7ad44da70eaf1d92b126c567766577.png)
Eye of depth III - (3)] mathematics: matrix eigenvalue and eigenvector 1

Recording multiple environments at a time leads to code bugs

Codeforces round #664C
随机推荐
Redis简单使用
C Programming Language(2nd Edition)--读书笔记--1.5.1
Collection and summary of penetration test information
Understand PHP from [Fifth space 2021] easycleanup_ session
Single page application spa and multi page application MPa
object-fit:cover; It doesn't work in the applet. How to deal with the deformation of the applet image
Eye of depth III - (7, 8)] mathematics: matrix diagonalization and quadratic form 2.3
es6 map提取数组对象
小程序嵌入网页向小程序跳转并传参,微信小程序中实现公众号授权获取openId
Common mode attack and shared prime of RSA
Eye of depth III - (4, 5)] mathematics: matrix eigenvalues and eigenvectors 2
Oracle automatic storage management 18C step-by-step installation -1
C Programming Language (2nd Edition)--读书笔记--1.4
深度之眼三——(3)】 數學:矩陣特征值與特征向量1
Record buuctf [netding Cup 2018] unfinish1 problem solving ideas
Day10 front back continuous adjustment
深度之眼三——(7,8)】数学:矩阵对角化及二次型2.3
PCRE bypasses regular
markdown编辑器语法——文字颜色、大小、字体与背景色的设置(转载)
量化行业知识汇总