Blame view

node_modules/uview-ui/components/u-table/u-table.vue 2.05 KB
c7add6cf   “wangming”   初始版本开发完毕
1
  <template>
25852764   unknown   s
2
3
  	<view class="u-table" :style="[tableStyle]">
  		<slot />
c7add6cf   “wangming”   初始版本开发完毕
4
5
6
7
  	</view>
  </template>
  
  <script>
c7add6cf   “wangming”   初始版本开发完毕
8
  	/**
25852764   unknown   s
9
10
  	 * table 表格
  	 * @description 表格组件一般用于展示大量结构化数据的场景
c7add6cf   “wangming”   初始版本开发完毕
11
  	 * @tutorial https://www.uviewui.com/components/table.html
25852764   unknown   s
12
13
14
15
16
17
18
19
20
21
  	 * @property {String} border-color 表格边框的颜色(默认#e4e7ed
  	 * @property {String} bg-color 表格的背景颜色(默认#ffffff
  	 * @property {String} align 单元格的内容对齐方式,作用类似csstext-align(默认center
  	 * @property {String} padding 单元格的内边距,同csspadding写法(默认10rpx 0
  	 * @property {String Number} font-size 单元格字体大小,单位rpx(默认28
  	 * @property {String} color 单元格字体颜色(默认#606266
  	 * @property {Object} th-style th单元格的样式,对象形式(th所需参数放在table组件,是为了避免每一个th组件要写一遍)
  	 * @event {Function} click 点击组件时触发
  	 * @event {Function} close 点击关闭按钮时触发
  	 * @example <u-table></u-table>
c7add6cf   “wangming”   初始版本开发完毕
22
23
  	 */
  	export default {
25852764   unknown   s
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
  		name: "u-table",
  		props: {
  			borderColor: {
  				type: String,
  				default: '#e4e7ed'
  			},
  			align: {
  				type: String,
  				default: 'center'
  			},
  			// td的内边距
  			padding: {
  				type: String,
  				default: '10rpx 6rpx'
  			},
  			// 字体大小
  			fontSize: {
  				type: [String, Number],
  				default: 28
  			},
  			// 字体颜色
  			color: {
  				type: String,
  				default: '#606266'
  			},
  			// th的自定义样式
  			thStyle: {
  				type: Object,
  				default () {
  					return {}
  				}
  			},
  			// table的背景颜色
  			bgColor: {
  				type: String,
  				default: '#ffffff'
  			}
  		},
c7add6cf   “wangming”   初始版本开发完毕
62
  		data() {
25852764   unknown   s
63
64
65
66
67
68
69
70
71
  			return {}
  		},
  		computed: {
  			tableStyle() {
  				let style = {};
  				style.borderLeft = `solid 1px ${this.borderColor}`;
  				style.borderTop = `solid 1px ${this.borderColor}`;
  				style.backgroundColor = this.bgColor;;
  				return style;
c7add6cf   “wangming”   初始版本开发完毕
72
73
74
75
76
77
  			}
  		}
  	}
  </script>
  
  <style lang="scss" scoped>
25852764   unknown   s
78
  	@import "../../libs/css/style.components.scss";
c7add6cf   “wangming”   初始版本开发完毕
79
  	
25852764   unknown   s
80
81
82
83
  	.u-table {
  		width: 100%;
  		box-sizing: border-box;
  	}
c7add6cf   “wangming”   初始版本开发完毕
84
  </style>