v-uni-app-ui 1.0.4 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -82
- package/dist/v-uni-app-ui.css +1 -0
- package/dist/v-uni-app-ui.es.js +6569 -0
- package/dist/v-uni-app-ui.umd.js +7 -0
- package/package.json +17 -5
- package/components/config/css/basic.scss +0 -19
- package/components/config/interface/basic-type.js +0 -16
- package/components/config/interface/components-interface.ts +0 -0
- package/components/config/interface/monitor/components/input-monitor.js +0 -0
- package/components/config/interface/monitor/property-monitor.ts +0 -136
- package/components/config/interface/props/basic-props.ts +0 -88
- package/components/config/interface/props/components/button-props.ts +0 -85
- package/components/config/interface/props/components/input-props.ts +0 -69
- package/components/config/interface/props/props-tools.ts +0 -64
- package/components/config/style/basic.js +0 -346
- package/components/config/style/component-registry.js +0 -142
- package/components/config/style/components/button-style.js +0 -160
- package/components/config/style/components/input-style.js +0 -98
- package/components/config/style/components-style.js +0 -622
- package/components/config/style/property-mapper.js +0 -377
- package/components/config/style/pseudo-processor.js +0 -213
- package/components/config.js +0 -123
- package/components/icon/iconfont.css +0 -87
- package/components/icon/iconfont.js +0 -1
- package/components/icon/iconfont.json +0 -135
- package/components/icon/iconfont.ttf +0 -0
- package/components/icon/iconfont.woff +0 -0
- package/components/icon/iconfont.woff2 +0 -0
- package/components/layout/v-card/v-card.vue +0 -108
- package/components/layout/v-grid/v-grid.vue +0 -162
- package/components/layout/v-icon-grid/v-icon-grid.vue +0 -195
- package/components/layout/v-infinite-scroll/v-infinite-scroll.vue +0 -172
- package/components/layout/v-list/v-list.vue +0 -43
- package/components/layout/v-row/v-row.vue +0 -142
- package/components/layout/v-waterfall/v-waterfall.vue +0 -79
- package/components/model/compound/v-checkbox-group/v-checkbox-group.vue +0 -96
- package/components/model/compound/v-console/v-console.js +0 -20
- package/components/model/compound/v-console/v-console.vue +0 -299
- package/components/model/compound/v-date-time/v-date-time.vue +0 -261
- package/components/model/compound/v-dialog/v-dialog.vue +0 -178
- package/components/model/compound/v-drum-select-picker/v-drum-select-picker.vue +0 -83
- package/components/model/compound/v-form/v-form.vue +0 -226
- package/components/model/compound/v-form-item/v-form-item.vue +0 -255
- package/components/model/compound/v-image/v-image.vue +0 -357
- package/components/model/compound/v-input-desensitize/v-input-desensitize.vue +0 -101
- package/components/model/compound/v-page/v-page.vue +0 -11
- package/components/model/compound/v-pages/v-pages.vue +0 -141
- package/components/model/compound/v-picker-list/v-picker-list.vue +0 -109
- package/components/model/compound/v-popup/v-popup.vue +0 -151
- package/components/model/compound/v-radio-group/v-radio-group.vue +0 -86
- package/components/model/compound/v-select-picker/v-select-picker.vue +0 -202
- package/components/model/compound/v-series-picker-list/v-series-picker-list.vue +0 -221
- package/components/model/compound/v-series-select-picker/v-series-select-picker.vue +0 -203
- package/components/model/compound/v-switch/v-switch.vue +0 -136
- package/components/model/compound/v-tabs-page/v-tabs-page.vue +0 -138
- package/components/model/native/v-badge/v-badge.vue +0 -143
- package/components/model/native/v-button/v-button.vue +0 -81
- package/components/model/native/v-carousel/v-carousel.vue +0 -138
- package/components/model/native/v-checkbox/v-checkbox.vue +0 -215
- package/components/model/native/v-collapse/v-collapse.vue +0 -190
- package/components/model/native/v-header-navigation-bar/v-header-navigation-bar.vue +0 -92
- package/components/model/native/v-input/v-input.vue +0 -163
- package/components/model/native/v-input-code/v-input-code.vue +0 -146
- package/components/model/native/v-loading/v-loading.vue +0 -206
- package/components/model/native/v-menu/v-menu.vue +0 -222
- package/components/model/native/v-menu-slide/v-menu-slide.vue +0 -364
- package/components/model/native/v-min-loading/v-min-loading.vue +0 -80
- package/components/model/native/v-null/v-null.vue +0 -97
- package/components/model/native/v-overlay/v-overlay.vue +0 -96
- package/components/model/native/v-pull-up-refresh/v-pull-up-refresh.vue +0 -157
- package/components/model/native/v-radio/v-radio.vue +0 -138
- package/components/model/native/v-scroll-list/v-scroll-list.vue +0 -169
- package/components/model/native/v-steps/v-steps.vue +0 -253
- package/components/model/native/v-table/v-table.vue +0 -203
- package/components/model/native/v-tabs/v-tabs.vue +0 -235
- package/components/model/native/v-tag/v-tag.vue +0 -206
- package/components/model/native/v-text/v-text.vue +0 -187
- package/components/model/native/v-textarea/v-textarea.vue +0 -178
- package/components/model/native/v-title/v-title.vue +0 -91
- package/components/model/native/v-toast/info.png +0 -0
- package/components/model/native/v-toast/success.png +0 -0
- package/components/model/native/v-toast/v-toast.vue +0 -198
- package/components/model/native/v-toast/warn.png +0 -0
- package/components/model/native/v-upload-file-button/v-upload-file-button.vue +0 -296
- package/components/model/native/v-video/v-video.vue +0 -175
- package/components/model/native/v-window/v-window.vue +0 -158
- package/components/utils/event-modifiers.ts +0 -139
- package/components/utils/validator.ts +0 -451
- package/index.js +0 -372
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="v-table-container">
|
|
3
|
-
<view class="v-table">
|
|
4
|
-
<view class="v-table-header" @click="handleHeaderClick">
|
|
5
|
-
<view class="v-table-header-cell" v-for="(column, index) in columns" :key="index" :style="{ width: column.width , flex: '1 1 0%'}">
|
|
6
|
-
{{ column.label }}
|
|
7
|
-
<view v-if="column.prop && sortable" class="sort-icon">
|
|
8
|
-
<text class="arrow-up" :class="{ active: column.prop === sortConfig.prop && sortConfig.order === 'asc' }">↑</text>
|
|
9
|
-
<text class="arrow-down" :class="{ active: column.prop === sortConfig.prop && sortConfig.order === 'desc' }">↓</text>
|
|
10
|
-
</view>
|
|
11
|
-
</view>
|
|
12
|
-
</view>
|
|
13
|
-
<view class="v-table-body">
|
|
14
|
-
<view v-if="!data.length" class="empty-data">
|
|
15
|
-
<slot name="empty">暂无数据</slot>
|
|
16
|
-
</view>
|
|
17
|
-
<view class="v-table-row" v-for="(row, rowIndex) in sortedData" :key="rowIndex">
|
|
18
|
-
<view class="v-table-cell" v-for="(column, colIndex) in columns" :key="colIndex" :style="{ width: column.width , flex: '1 1 0%'}">
|
|
19
|
-
<slot :name="`cell-${column.prop}`" :row="row" :column="column" :index="rowIndex">
|
|
20
|
-
{{ row[column.prop] }}
|
|
21
|
-
</slot>
|
|
22
|
-
</view>
|
|
23
|
-
</view>
|
|
24
|
-
</view>
|
|
25
|
-
</view>
|
|
26
|
-
</view>
|
|
27
|
-
</template>
|
|
28
|
-
|
|
29
|
-
<script lang="ts" setup>
|
|
30
|
-
import { computed, ref ,inject} from 'vue';
|
|
31
|
-
|
|
32
|
-
interface TableColumn {
|
|
33
|
-
prop: string;
|
|
34
|
-
label: string;
|
|
35
|
-
width?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
interface SortConfig {
|
|
39
|
-
prop: string | null;
|
|
40
|
-
order: 'asc' | 'desc' | null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* v-table
|
|
45
|
-
* columns 表格列配置
|
|
46
|
-
* prop 表格列绑定的数据属性名
|
|
47
|
-
* label 表格列标题
|
|
48
|
-
* width 表格列宽度
|
|
49
|
-
* data 表格数据数组
|
|
50
|
-
* sortable 是否支持排序 默认值:false 可选值true支持排序、false不支持排序
|
|
51
|
-
*/
|
|
52
|
-
const props = defineProps({
|
|
53
|
-
columns: {
|
|
54
|
-
type: Array,
|
|
55
|
-
default: () => [],
|
|
56
|
-
required: true
|
|
57
|
-
},
|
|
58
|
-
data: {
|
|
59
|
-
type: Array,
|
|
60
|
-
default: () => []
|
|
61
|
-
},
|
|
62
|
-
sortable: {
|
|
63
|
-
type: Boolean,
|
|
64
|
-
default: false
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const config = inject<any>('config');
|
|
69
|
-
const sortConfig = ref<SortConfig>({
|
|
70
|
-
prop: null,
|
|
71
|
-
order: null
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const sortedData = computed(() => {
|
|
75
|
-
if (!props.sortable || !props.data.length || !sortConfig.value.prop) {
|
|
76
|
-
return props.data;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return [...props.data].sort((a, b) => {
|
|
80
|
-
const aValue = a[sortConfig.value.prop];
|
|
81
|
-
const bValue = b[sortConfig.value.prop];
|
|
82
|
-
|
|
83
|
-
if (sortConfig.value.order === 'asc') {
|
|
84
|
-
return aValue > bValue ? 1 : -1;
|
|
85
|
-
} else {
|
|
86
|
-
return aValue < bValue ? 1 : -1;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
const handleHeaderClick = (event: any) => {
|
|
92
|
-
const target = event.target;
|
|
93
|
-
const columnName = target.closest('.v-table-header-cell');
|
|
94
|
-
if (!columnName) return;
|
|
95
|
-
|
|
96
|
-
const columnProp = props.columns.find((col, index) => {
|
|
97
|
-
const cell = target.closest('.v-table-header-cell');
|
|
98
|
-
return cell && cell.getAttribute('data-index') === index.toString();
|
|
99
|
-
}).prop;
|
|
100
|
-
|
|
101
|
-
if (!columnProp) return;
|
|
102
|
-
|
|
103
|
-
if (sortConfig.value.prop === columnProp) {
|
|
104
|
-
sortConfig.value.order = sortConfig.value.order === 'asc' ? 'desc' : 'asc';
|
|
105
|
-
} else {
|
|
106
|
-
sortConfig.value.prop = columnProp;
|
|
107
|
-
sortConfig.value.order = 'asc';
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
</script>
|
|
111
|
-
|
|
112
|
-
<style lang="scss" scoped>
|
|
113
|
-
.v-table-container {
|
|
114
|
-
width: 100%;
|
|
115
|
-
border-radius: 8rpx;
|
|
116
|
-
overflow: hidden;
|
|
117
|
-
box-shadow: 0 2rpx 12rpx 0 rgba(0, 0, 0, 0.1);
|
|
118
|
-
border: 1rpx solid v-bind("config.border.color");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.v-table {
|
|
122
|
-
width: 100%;
|
|
123
|
-
box-sizing: border-box;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.v-table-header {
|
|
127
|
-
display: flex;
|
|
128
|
-
background-color: v-bind("config.VTable.backgroundColor");
|
|
129
|
-
border-bottom: 1rpx solid v-bind("config.border.color");
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.v-table-header-cell {
|
|
133
|
-
padding: 12rpx 16rpx;
|
|
134
|
-
font-weight: bold;
|
|
135
|
-
color: v-bind("config.fontColor.mianTitle");
|
|
136
|
-
text-align: left;
|
|
137
|
-
box-sizing: border-box;
|
|
138
|
-
border-right: 1rpx solid v-bind("config.border.color");
|
|
139
|
-
cursor: pointer;
|
|
140
|
-
position: relative;
|
|
141
|
-
user-select: none;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
.v-table-header-cell:hover {
|
|
145
|
-
background-color: v-bind("config.VTable.backgroundColor");
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.sort-icon {
|
|
149
|
-
display: inline-block;
|
|
150
|
-
margin-left: 5rpx;
|
|
151
|
-
vertical-align: middle;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.arrow-up,
|
|
155
|
-
.arrow-down {
|
|
156
|
-
display: block;
|
|
157
|
-
font-size: v-bind("config.fontSize.smallText");
|
|
158
|
-
color: v-bind("config.fontColor.text");
|
|
159
|
-
margin: 0 2rpx;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.arrow-up.active,
|
|
163
|
-
.arrow-down.active {
|
|
164
|
-
color: v-bind("config.fontColor.default");
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.v-table-body {
|
|
168
|
-
display: flex;
|
|
169
|
-
flex-direction: column;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
.v-table-row {
|
|
173
|
-
display: flex;
|
|
174
|
-
border-bottom: 1rpx solid v-bind("config.border.color");
|
|
175
|
-
transition: background-color 0.3s;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.v-table-row:hover {
|
|
179
|
-
background-color: v-bind("config.VTable.backgroundColor");
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.v-table-row:last-child {
|
|
183
|
-
border-bottom: none;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.v-table-row:nth-child(even) {
|
|
187
|
-
background-color: #v-bind("config.VTable.backgroundColor");
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.v-table-cell {
|
|
191
|
-
padding: 12px 16px;
|
|
192
|
-
color: v-bind("config.fontColor.text");
|
|
193
|
-
text-align: left;
|
|
194
|
-
box-sizing: border-box;
|
|
195
|
-
border-right: 1rpx solid v-bind("config.border.color");
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.empty-data {
|
|
199
|
-
padding: 20rpx;
|
|
200
|
-
text-align: center;
|
|
201
|
-
color: v-bind("config.fontColor.text");
|
|
202
|
-
}
|
|
203
|
-
</style>
|
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view class="v-tabs">
|
|
3
|
-
<scroll-view scroll-x class="tabs-scroll" :scroll-left="scrollLeft" :show-scrollbar="false" :scroll-with-animation="true">
|
|
4
|
-
<view class="tabs-container">
|
|
5
|
-
<view
|
|
6
|
-
v-for="(item, index) in tabs"
|
|
7
|
-
:key="item.key || index"
|
|
8
|
-
class="tab-item"
|
|
9
|
-
:class="[{ active: index === activeIndex }, hoverClass]"
|
|
10
|
-
:style="{
|
|
11
|
-
minWidth: `${minTabWidth}rpx`,
|
|
12
|
-
padding: `0 ${itemPadding}rpx`
|
|
13
|
-
}"
|
|
14
|
-
@click="handleTabClick(index)"
|
|
15
|
-
:id="`tab_${index}`"
|
|
16
|
-
>
|
|
17
|
-
<text class="tab-text">{{ item.title }}</text>
|
|
18
|
-
</view>
|
|
19
|
-
<view v-show="isLine" class="tab-line" :style="lineStyle"></view>
|
|
20
|
-
</view>
|
|
21
|
-
</scroll-view>
|
|
22
|
-
</view>
|
|
23
|
-
</template>
|
|
24
|
-
|
|
25
|
-
<script lang="ts" setup>
|
|
26
|
-
import { ref, computed, watch, onMounted, nextTick } from 'vue';
|
|
27
|
-
|
|
28
|
-
interface TabList {
|
|
29
|
-
title: string;
|
|
30
|
-
key: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* v-tabs 标签页 无内容
|
|
35
|
-
* value 双向绑定值 默认值:0
|
|
36
|
-
* tabs 标签标题
|
|
37
|
-
* activeColor 高亮颜色 默认值:#287afa
|
|
38
|
-
* inactiveColor 标题颜色 默认值:#666
|
|
39
|
-
* isLine 是否显示下划线 默认值:true
|
|
40
|
-
* lineWidth 下划线宽度 默认值:最大标题宽度
|
|
41
|
-
* lineHeight 下划线厚度 默认值:8
|
|
42
|
-
* lineOffset 下划线距离标题距离 默认值:4
|
|
43
|
-
* minTabWidth 最小标题宽度 默认值:120
|
|
44
|
-
* itemPadding 标题内边距 默认值:32
|
|
45
|
-
* hoverClass 悬浮名称 默认值:tabs-hover
|
|
46
|
-
* 相关事件:change
|
|
47
|
-
*/
|
|
48
|
-
const props = defineProps({
|
|
49
|
-
value: {
|
|
50
|
-
type: Number,
|
|
51
|
-
default: 0
|
|
52
|
-
},
|
|
53
|
-
tabs: {
|
|
54
|
-
type: Array as () => TabList[],
|
|
55
|
-
required: true
|
|
56
|
-
},
|
|
57
|
-
activeColor: {
|
|
58
|
-
type: String,
|
|
59
|
-
default: '#287afa'
|
|
60
|
-
},
|
|
61
|
-
inactiveColor: {
|
|
62
|
-
type: String,
|
|
63
|
-
default: '#666'
|
|
64
|
-
},
|
|
65
|
-
isLine: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: true
|
|
68
|
-
},
|
|
69
|
-
lineHeight: {
|
|
70
|
-
type: String,
|
|
71
|
-
default: '8'
|
|
72
|
-
},
|
|
73
|
-
lineWidth: {
|
|
74
|
-
type: Number,
|
|
75
|
-
default: 20
|
|
76
|
-
},
|
|
77
|
-
lineOffset: {
|
|
78
|
-
type: Number,
|
|
79
|
-
default: 0
|
|
80
|
-
},
|
|
81
|
-
minTabWidth: {
|
|
82
|
-
type: Number,
|
|
83
|
-
default: 120
|
|
84
|
-
},
|
|
85
|
-
itemPadding: {
|
|
86
|
-
type: Number,
|
|
87
|
-
default: 32
|
|
88
|
-
},
|
|
89
|
-
hoverClass: {
|
|
90
|
-
type: String,
|
|
91
|
-
default: 'tabs-hover'
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const emit = defineEmits(['update:value', 'change']);
|
|
96
|
-
|
|
97
|
-
const activeIndex = ref(props.value);
|
|
98
|
-
const tabRects = ref<{ left: number; width: number }[]>([]);
|
|
99
|
-
const scrollLeft = ref(0);
|
|
100
|
-
const isLandscape = ref(false);
|
|
101
|
-
|
|
102
|
-
const lineStyle = computed(() => {
|
|
103
|
-
if (!tabRects.value[activeIndex.value]) return {};
|
|
104
|
-
const current = tabRects.value[activeIndex.value];
|
|
105
|
-
return {
|
|
106
|
-
width: `${props.lineWidth === 0 ? current.width : props.lineWidth}px`,
|
|
107
|
-
transform: `translateX(${current.left}px)`,
|
|
108
|
-
backgroundColor: props.activeColor,
|
|
109
|
-
height: uni.upx2px(parseFloat(props.lineHeight)) + 'px',
|
|
110
|
-
bottom: `2rpx`
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
let updateTimer = null;
|
|
115
|
-
const updateTabRects = () => {
|
|
116
|
-
clearTimeout(updateTimer);
|
|
117
|
-
updateTimer = setTimeout(() => {
|
|
118
|
-
nextTick(() => {
|
|
119
|
-
uni.createSelectorQuery()
|
|
120
|
-
.selectAll('.tab-item')
|
|
121
|
-
.boundingClientRect((rects: any) => {
|
|
122
|
-
tabRects.value = rects.map((rect: any) => ({
|
|
123
|
-
left: rect.left - (rects[0]?.left || 0),
|
|
124
|
-
width: rect.width
|
|
125
|
-
}));
|
|
126
|
-
})
|
|
127
|
-
.exec();
|
|
128
|
-
});
|
|
129
|
-
}, 100);
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const handleTabClick = (index: number) => {
|
|
133
|
-
if (activeIndex.value === index) return;
|
|
134
|
-
activeIndex.value = index;
|
|
135
|
-
scrollToTab(index);
|
|
136
|
-
emit('change', index);
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const scrollToTab = (index: number) => {
|
|
140
|
-
const current = tabRects.value[index];
|
|
141
|
-
if (!current) return;
|
|
142
|
-
|
|
143
|
-
const systemInfo = uni.getSystemInfoSync();
|
|
144
|
-
const tabWidth = current.width;
|
|
145
|
-
const tabLeft = current.left;
|
|
146
|
-
|
|
147
|
-
const viewCenter = systemInfo.windowWidth / 2;
|
|
148
|
-
const tabCenter = tabLeft + tabWidth / 2;
|
|
149
|
-
const targetScroll = Math.max(0, tabCenter - viewCenter);
|
|
150
|
-
|
|
151
|
-
requestAnimationFrame(() => {
|
|
152
|
-
scrollLeft.value = targetScroll;
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const checkOrientation = () => {
|
|
157
|
-
const { windowWidth, windowHeight } = uni.getSystemInfoSync();
|
|
158
|
-
isLandscape.value = windowWidth > windowHeight;
|
|
159
|
-
updateTabRects();
|
|
160
|
-
scrollToTab(activeIndex.value);
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
watch(activeIndex, (val) => {
|
|
164
|
-
emit('update:value', val);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
onMounted(() => {
|
|
168
|
-
checkOrientation();
|
|
169
|
-
uni.onWindowResize(checkOrientation);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
watch(() => props.tabs, updateTabRects);
|
|
173
|
-
</script>
|
|
174
|
-
|
|
175
|
-
<style lang="scss" scoped>
|
|
176
|
-
.v-tabs {
|
|
177
|
-
width: 100%;
|
|
178
|
-
background-color: #fff;
|
|
179
|
-
position: relative;
|
|
180
|
-
padding: 0 env(safe-area-inset-left);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.tabs-scroll {
|
|
184
|
-
width: 100%;
|
|
185
|
-
white-space: nowrap;
|
|
186
|
-
padding: 0 env(safe-area-inset-right);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.tabs-container {
|
|
190
|
-
position: relative;
|
|
191
|
-
display: inline-flex;
|
|
192
|
-
height: 80rpx;
|
|
193
|
-
align-items: center;
|
|
194
|
-
padding: 0 20rpx;
|
|
195
|
-
will-change: transform;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.tab-item {
|
|
199
|
-
position: relative;
|
|
200
|
-
height: 100%;
|
|
201
|
-
display: inline-flex;
|
|
202
|
-
align-items: center;
|
|
203
|
-
transition: color 0.3s;
|
|
204
|
-
flex-shrink: 0;
|
|
205
|
-
|
|
206
|
-
&.active {
|
|
207
|
-
.tab-text {
|
|
208
|
-
color: v-bind('props.activeColor');
|
|
209
|
-
font-weight: 500;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
.tab-text {
|
|
214
|
-
margin: auto;
|
|
215
|
-
font-size: clamp(24rpx, 4vw, 32rpx);
|
|
216
|
-
color: v-bind('props.inactiveColor');
|
|
217
|
-
transition: color 0.3s;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.tab-line {
|
|
222
|
-
position: absolute;
|
|
223
|
-
bottom: 0;
|
|
224
|
-
border-radius: v-bind('props.lineHeight');
|
|
225
|
-
transition: all 0.3s cubic-bezier(0.35, 0, 0.25, 1);
|
|
226
|
-
transform-origin: 0 50%;
|
|
227
|
-
-webkit-backface-visibility: hidden;
|
|
228
|
-
backface-visibility: hidden;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.tabs-hover {
|
|
232
|
-
opacity: 0.6;
|
|
233
|
-
transition: opacity 0.2s;
|
|
234
|
-
}
|
|
235
|
-
</style>
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<view
|
|
3
|
-
v-show="show"
|
|
4
|
-
:class="['v-tag', `v-tag--${type}`, `v-tag--${model}`, { 'v-tag--disabled': disabled, 'v-tag--plain': plain }, `v-tag--${size}`]"
|
|
5
|
-
@click="handleClick"
|
|
6
|
-
:style="{ backgroundColor: bgColor, color: txtColor }"
|
|
7
|
-
>
|
|
8
|
-
<view v-if="closable && !disabled" class="v-tag-close" @click.stop="handleClose">×</view>
|
|
9
|
-
<text class="v-tag-content">
|
|
10
|
-
<slot>{{ content }}</slot>
|
|
11
|
-
</text>
|
|
12
|
-
</view>
|
|
13
|
-
</template>
|
|
14
|
-
|
|
15
|
-
<script setup lang="ts">
|
|
16
|
-
import { ref, inject, computed } from 'vue';
|
|
17
|
-
|
|
18
|
-
const props = defineProps({
|
|
19
|
-
type: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: 'default',
|
|
22
|
-
validator: (value: string) => {
|
|
23
|
-
return ['default', 'delete', 'succeed', 'info', 'warn'].includes(value);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
model: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: 'semicircle',
|
|
29
|
-
validator: (value: string) => {
|
|
30
|
-
return ['semicircle', 'circle', 'square'].includes(value);
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
size: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: 'medium',
|
|
36
|
-
validator: (value: string) => ['small', 'medium', 'large'].includes(value)
|
|
37
|
-
},
|
|
38
|
-
content: {
|
|
39
|
-
type: String,
|
|
40
|
-
default: ''
|
|
41
|
-
},
|
|
42
|
-
backgroundColor: {
|
|
43
|
-
type: String,
|
|
44
|
-
default: ''
|
|
45
|
-
},
|
|
46
|
-
fontColor: {
|
|
47
|
-
type: String,
|
|
48
|
-
default: ''
|
|
49
|
-
},
|
|
50
|
-
closable: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: false
|
|
53
|
-
},
|
|
54
|
-
disabled: {
|
|
55
|
-
type: Boolean,
|
|
56
|
-
default: false
|
|
57
|
-
},
|
|
58
|
-
plain: {
|
|
59
|
-
type: Boolean,
|
|
60
|
-
default: false
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const emit = defineEmits(['click', 'close']);
|
|
65
|
-
|
|
66
|
-
const config = inject<any>('config');
|
|
67
|
-
const show = ref(true);
|
|
68
|
-
|
|
69
|
-
const bgColor = computed(() => props.backgroundColor );
|
|
70
|
-
|
|
71
|
-
const txtColor = computed(() => props.fontColor );
|
|
72
|
-
|
|
73
|
-
const handleClick = (event: MouseEvent) => {
|
|
74
|
-
if (!props.disabled) {
|
|
75
|
-
emit('click', event);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const handleClose = () => {
|
|
80
|
-
if (!props.disabled && props.closable) {
|
|
81
|
-
show.value = false;
|
|
82
|
-
emit('close', props.content, show.value);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
</script>
|
|
86
|
-
|
|
87
|
-
<style lang="scss" scoped>
|
|
88
|
-
.v-tag {
|
|
89
|
-
display: inline-flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
cursor: pointer;
|
|
92
|
-
position: relative;
|
|
93
|
-
transition: all 0.3s;
|
|
94
|
-
color: v-bind('config.fontColor.reversal');
|
|
95
|
-
|
|
96
|
-
.v-tag-content {
|
|
97
|
-
text-align: center;
|
|
98
|
-
margin: auto;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.v-tag-close {
|
|
102
|
-
width: 18rpx;
|
|
103
|
-
height: 18rpx;
|
|
104
|
-
position: absolute;
|
|
105
|
-
top: -10rpx;
|
|
106
|
-
right: -10rpx;
|
|
107
|
-
cursor: pointer;
|
|
108
|
-
color: #fff;
|
|
109
|
-
background-color: #666666;
|
|
110
|
-
font-weight: bold;
|
|
111
|
-
font-size: 15rpx;
|
|
112
|
-
padding: 5rpx;
|
|
113
|
-
border-radius: 50%;
|
|
114
|
-
text-align: center;
|
|
115
|
-
line-height: 18rpx;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
&--small {
|
|
119
|
-
padding: 14rpx 10rpx;
|
|
120
|
-
font-size: v-bind('config.fontSize.smallText');
|
|
121
|
-
}
|
|
122
|
-
&--medium {
|
|
123
|
-
padding: 15rpx 12.5rpx;
|
|
124
|
-
font-size: v-bind('config.fontSize.mediumText');
|
|
125
|
-
}
|
|
126
|
-
&--large {
|
|
127
|
-
padding: 20rpx 15rpx;
|
|
128
|
-
font-size: v-bind('config.fontSize.largeText');
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
&--default {
|
|
132
|
-
background-color: v-bind('config.backgroundColor.default');
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
&--succeed {
|
|
136
|
-
background-color: v-bind('config.backgroundColor.succeed');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
&--warn {
|
|
140
|
-
background-color: v-bind('config.backgroundColor.warn');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
&--delete {
|
|
144
|
-
background-color: v-bind('config.backgroundColor.delete');
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
&--info {
|
|
148
|
-
background-color: v-bind('config.backgroundColor.info');
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
&--semicircle {
|
|
152
|
-
border-radius: v-bind('config.borderRadius.semicircle');
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
&--circle {
|
|
156
|
-
border-radius: v-bind('config.borderRadius.circle');
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
&--square {
|
|
160
|
-
border-radius: v-bind('config.borderRadius.square');
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
&--disabled {
|
|
164
|
-
opacity: v-bind('config.opacity.disabled');
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
&--plain {
|
|
168
|
-
background-color: transparent;
|
|
169
|
-
border: 1rpx solid;
|
|
170
|
-
padding: 8rpx 12rpx;
|
|
171
|
-
|
|
172
|
-
&.v-tag--default {
|
|
173
|
-
border-color: v-bind('config.border.default');
|
|
174
|
-
color: v-bind('config.fontColor.default');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
&.v-tag--succeed {
|
|
178
|
-
border-color: v-bind('config.border.succeed');
|
|
179
|
-
color: v-bind('config.fontColor.succeed');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
&.v-tag--warn {
|
|
183
|
-
border-color: v-bind('config.border.warn');
|
|
184
|
-
color: v-bind('config.fontColor.warn');
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
&.v-tag--delete {
|
|
188
|
-
border-color: v-bind('config.border.delete');
|
|
189
|
-
color: v-bind('config.fontColor.delete');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
&.v-tag--info {
|
|
193
|
-
border-color: v-bind('config.border.info');
|
|
194
|
-
color: v-bind('config.fontColor.info');
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
&.v-tag--semicircle {
|
|
198
|
-
border-radius: v-bind('config.borderRadius.semicircle');
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
&.v-tag--square {
|
|
202
|
-
border-radius: v-bind('config.borderRadius.square');
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
</style>
|