radius.nvue
3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<template>
<view class="container">
<uni-card :is-shadow="false" is-full>
<view class="header"><text class="uni-h6">使用边框半径辅助样式对元素快速应用</text> <text
class="uni-primary uni-px-3 uni-h6">border-radius</text> <text class="uni-h6">样式。</text></view>
<view class="uni-mt-5 header" ><text class="uni-h6">规则为</text> <text
class="uni-primary uni-pl-3 uni-h6">uni-radius-${direction}-${size}</text></view>
<view class="uni-mt-5 header"><text class="uni-h6">如果需要四边,则不需要指定</text> <text class="uni-primary uni-pl-3 uni-h6">direction</text></view>
<view class="uni-mt-5"><text class="uni-h6">各值的含义请参考文档</text></view>
</uni-card>
<uni-section title="效果展示" type="line">
<view class="margin">
<view class="box uni-primary-bg uni-ma-5" :class="[radiusClass]">
<text class="uni-white">通过下面的选项控制圆角</text>
</view>
</view>
<view class="actions uni-mt-10">
<text class="action-label">位置</text>
<uni-data-checkbox v-model="formData.direction" multiple :localdata="directionData"
@change="change($event,1)"></uni-data-checkbox>
</view>
<view class="actions uni-mt-3 uni-mb-10">
<text class="action-label">大小</text>
<uni-data-checkbox v-model="formData.size" :localdata="sizeData" @change="change($event,2)">
</uni-data-checkbox>
</view>
</uni-section>
</view>
</template>
<script>
export default {
data() {
return {
radiusClass: 'uni-radius-lg',
formData: {
direction: ['t', 'b'],
size: 'lg'
},
directionData: [{
value: 't',
text: '左上+右上'
}, {
value: 'r',
text: '右上+右下'
}, {
value: 'b',
text: '左下+右下'
}, {
value: 'l',
text: '右上+左下'
}, {
value: 'tl',
text: '左上'
}, {
value: 'tr',
text: '右上'
}, {
value: 'bl',
text: '左下'
}, {
value: 'br',
text: '右下'
}],
sizeData: [{
value: '0',
text: '无'
}, {
value: 'sm',
text: '小'
}, {
value: 'lg',
text: '常规'
}, {
value: 'xl',
text: '大'
}, {
value: 'circle',
text: '圆'
}, {
value: 'pill',
text: '最大化'
}]
}
},
onLoad() {},
methods: {
change(e, type) {
let {
direction,
size
} = this.formData
this.radiusClass = ''
direction.forEach(v => {
this.radiusClass += `uni-radius-${v}-${size} `
})
}
}
}
</script>
<style>
.header {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.margin {
display: flex;
height: 200px;
margin: 10px;
overflow: hidden;
border-radius: 5px;
border: 1px #eee solid;
/* #ifndef APP-NVUE */
box-sizing: border-box;
/* #endif */
}
.margin-item {
display: flex;
flex: 1;
}
.box {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
}
.actions {
display: flex;
flex-direction: row;
align-items: center;
}
.action-label {
/* #ifndef APP-NVUE */
flex-shrink: 0;
/* #endif */
width: 50px;
margin-left: 10px;
margin-right: 10px;
font-size: 12px;
}
</style>