Blame view

components/thorui/tui-label/tui-label.vue 932 Bytes
46b6767c   刘淇   init 提交到库
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
  <template>
  	<view class="tui-label__box" :class="{'tui-label__full':isFull}" :style="{padding:padding,margin:margin}"
  		@tap.stop="onClick">
  		<slot></slot>
  	</view>
  </template>
  
  <script>
  	//该组件主要用于tui-radio,tui-checkbox,tui-switch组件外层,类似label功能
  	export default {
  		name: "tui-label",
  		props: {
  			padding: {
  				type: String,
  				default: '0'
  			},
  			margin: {
  				type: String,
  				default: '0'
  			},
  			isFull: {
  				type: Boolean,
  				default: false
  			}
  		},
  		created() {
  			this.childrens = [];
  		},
  		methods: {
  			onClick() {
  				if (this.childrens && this.childrens.length > 0) {
  					for (let child of this.childrens) {
  						child.labelClick()
  					}
  				}
  			}
  		}
  	}
  </script>
  
  <style scoped>
  	.tui-label__box {
  		/* #ifndef APP-NVUE */
  		box-sizing: border-box;
  		/* #endif */
  	}
  
  	.tui-label__full {
  		flex: 1;
  		/* #ifndef APP-NVUE */
  		width: 100%;
  		/* #endif */
  	}
  </style>