抽离公共状态组件
This commit is contained in:
@@ -32,11 +32,9 @@
|
||||
<text class="td flex-4">{{ item.name }}</text>
|
||||
<text class="td flex-5 color-6">{{ item.desc }}</text>
|
||||
<view class="td flex-2 row-center">
|
||||
<view class="status-switch-mini" :class="item.status ? 'active' : ''" @click="toggleStatus(index)">
|
||||
<view class="switch-dot-mini"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="td flex-2 row-center">
|
||||
<StatusSwitch v-model="item.status" activeText="显示" inactiveText="隐藏" />
|
||||
</view>
|
||||
<view class="td flex-2 row-center">
|
||||
<text class="btn-action-blue" @click="openModal(item)">编辑</text>
|
||||
<view class="v-divider-line"></view>
|
||||
<text class="btn-action-red" @click="deleteItem(index)">删除</text>
|
||||
@@ -105,6 +103,7 @@
|
||||
|
||||
<script setup lang="uts">
|
||||
import { ref, reactive } from 'vue'
|
||||
import StatusSwitch from '@/components/StatusSwitch.uvue'
|
||||
|
||||
interface ProtectionItem {
|
||||
id: number;
|
||||
@@ -268,29 +267,6 @@ function deleteItem(index: number) {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
/* Switch */
|
||||
.status-switch-mini {
|
||||
width: 44px;
|
||||
height: 20px;
|
||||
background-color: #ccc;
|
||||
border-radius: 10px;
|
||||
position: relative;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.status-switch-mini.active { background-color: #1890ff; }
|
||||
.switch-dot-mini {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
background-color: #fff;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
left: 2px;
|
||||
transition: left 0.3s;
|
||||
}
|
||||
.status-switch-mini.active .switch-dot-mini { left: 26px; }
|
||||
|
||||
.btn-action-blue { color: #1890ff; font-size: 14px; cursor: pointer; }
|
||||
.btn-action-red { color: #ff4d4f; font-size: 14px; cursor: pointer; }
|
||||
.v-divider-line { width: 1px; height: 12px; background-color: #eee; margin: 0 10px; }
|
||||
|
||||
Reference in New Issue
Block a user