feat: add switch for toggle mode
This commit is contained in:
@@ -36,14 +36,15 @@ const toggleStuff = (item: StuffItem) => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<button m="x-1" class="btn" :bg="strict && 'orange-500 hover:orange-600'" @click="strict = !strict">
|
<div class="inline-flex justify-center items-center">
|
||||||
<span v-if="strict">
|
<span :class="!strict && 'text-green-600'" font="bold" m="x-1" @click="strict = false">模糊匹配</span>
|
||||||
严格模式
|
<label m="x-1" class="switch">
|
||||||
</span>
|
<input v-model="strict" type="checkbox">
|
||||||
<span v-else>
|
<span class="slider round" />
|
||||||
宽松模式
|
</label>
|
||||||
</span>
|
<span :class="strict && 'text-green-600'" font="bold" m="x-1" @click="strict = true">严格匹配</span>
|
||||||
</button>
|
</div>
|
||||||
|
|
||||||
<div m="y-4">
|
<div m="y-4">
|
||||||
<h2 text="xl" font="bold" p="1">
|
<h2 text="xl" font="bold" p="1">
|
||||||
🥬 菜菜
|
🥬 菜菜
|
||||||
@@ -136,3 +137,63 @@ const toggleStuff = (item: StuffItem) => {
|
|||||||
</Transition>
|
</Transition>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.switch {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
width: 48px;
|
||||||
|
height: 28px;
|
||||||
|
|
||||||
|
input {
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.slider {
|
||||||
|
position: absolute;
|
||||||
|
cursor: pointer;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background-color: #ccc;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
$size: 20px;
|
||||||
|
|
||||||
|
.slider:before {
|
||||||
|
position: absolute;
|
||||||
|
content: "";
|
||||||
|
height: $size;
|
||||||
|
width: $size;
|
||||||
|
left: 4px;
|
||||||
|
bottom: 4px;
|
||||||
|
background-color: white;
|
||||||
|
-webkit-transition: .4s;
|
||||||
|
transition: .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider {
|
||||||
|
background-color: green;
|
||||||
|
}
|
||||||
|
|
||||||
|
input:checked + .slider:before {
|
||||||
|
-webkit-transform: translateX($size);
|
||||||
|
-ms-transform: translateX($size);
|
||||||
|
transform: translateX($size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Rounded sliders */
|
||||||
|
.slider.round {
|
||||||
|
border-radius: 28px;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -9,3 +9,8 @@ title: 关于
|
|||||||
**🍜 好的,今天我们来做菜!**
|
**🍜 好的,今天我们来做菜!**
|
||||||
|
|
||||||
代码请见 [YunYouJun/cook](https://github.com/YunYouJun/cook)。
|
代码请见 [YunYouJun/cook](https://github.com/YunYouJun/cook)。
|
||||||
|
|
||||||
|
<div class="flex justify-center items-center">
|
||||||
|
Made by
|
||||||
|
<div class="inline-flex" m="x-1" i-ri-bilibili-line /><a class="inline-flex" href="https://space.bilibili.com/1579790" target="_blank">云游君 Official</a>
|
||||||
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div text-4xl m="t-4">
|
<div text-4xl m="t-4">
|
||||||
<div i-mdi-pot-steam-outline inline-block />
|
<div i-mdi-pot-steam-outline inline-block />
|
||||||
</div>
|
</div>
|
||||||
<p m="2">
|
<p text="sm" m="b-4">
|
||||||
好的,今天我们来做菜!
|
好的,今天我们来做菜!
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
Reference in New Issue
Block a user