Browse Source

组件`Cell` 增加required属性

ming 3 years ago
parent
commit
00b5c596bc
1 changed files with 14 additions and 1 deletions
  1. 14 1
      components/fs-cell/fs-cell.vue

+ 14 - 1
components/fs-cell/fs-cell.vue

@@ -6,7 +6,7 @@
 		@click="handleClick"
 	>
 		<view class="fs-cell-flex" :class="['fs-cell-align-' + align, justify,{reverse}]">
-			<view class="fs-cell-title" :style="titleStyle">
+			<view class="fs-cell-title" :class="{ 'fs-cell-required': required }" :style="titleStyle">
 				<template v-if="title">{{title}}</template>
 				<slot v-else name="title"></slot>
 			</view>
@@ -54,6 +54,7 @@
 		gutter: Boolean,
 		radius: Boolean,
 		reverse: Boolean,
+		required: Boolean,
 		align: {
 			type: String,
 			default: 'center',
@@ -153,6 +154,18 @@
 		}
 	}
 	
+	&-required{
+		position: relative;
+		padding-left: 7px;
+		
+		&::before{
+			position: absolute;
+			content: '*';
+			color: red;
+			left: 0;
+		}
+	}
+		
 	&.gutter {
 		margin-bottom: var(--gutter-v);
 	}