Browse Source

upd(SearchBar): 增加props控制内部Icon尺寸和颜色

Frans 6 years ago
parent
commit
45557f03ee

+ 10 - 0
CHANGELOG.md

@@ -1,3 +1,13 @@
+## 2.1.4
+
+`2019-7-10`
+
+* :sparkles: upd(SearchBar): 增加props控制内部Icon尺寸和颜色
+* :bug: fix(Skeleton): 修复文档无法查看的问题
+* :bug: fix: 修复国际化语言包一处错误
+* :zap: chore: 优化服务端渲染
+* :zap: doc: 新增加入我们页面
+
 ## 2.1.3
 ## 2.1.3
 
 
 `2019-6-26`
 `2019-6-26`

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "@nutui/nutui",
   "name": "@nutui/nutui",
-  "version": "2.1.3",
+  "version": "2.1.4",
   "description": "一套轻量级移动端Vue组件库",
   "description": "一套轻量级移动端Vue组件库",
   "typings": "dist/types/index.d.ts",
   "typings": "dist/types/index.d.ts",
   "main": "dist/nutui.js",
   "main": "dist/nutui.js",

+ 2 - 3
src/locales/lang/en-US.js

@@ -2,8 +2,6 @@ import Vue from 'vue'
 
 
 const lang = {
 const lang = {
     lang: {
     lang: {
-        okBtnTxt: 'Ok',
-        cancelBtnTxt: 'Cancel',
         calendar: {
         calendar: {
             loadPrevMonth: 'Load the last month',
             loadPrevMonth: 'Load the last month',
             noMoreMonth: 'No earlier month~',
             noMoreMonth: 'No earlier month~',
@@ -34,7 +32,8 @@ const lang = {
             limitError: 'File size exceeded the limit'
             limitError: 'File size exceeded the limit'
         }
         }
         okBtnTxt: 'Ok',
         okBtnTxt: 'Ok',
-        cancelText: 'Cancel'
+        cancelText: 'Cancel',
+        cancelBtnTxt: 'Cancel',
     }
     }
 }
 }
 
 

+ 7 - 1
src/packages/searchbar/doc.md

@@ -80,7 +80,13 @@ export default {
 | hasTextButton | 右侧搜索按钮是否为文字按钮 | Boolean | false
 | hasTextButton | 右侧搜索按钮是否为文字按钮 | Boolean | false
 | textInfo | 右侧文字搜索按钮文案 | String | '搜索'
 | textInfo | 右侧文字搜索按钮文案 | String | '搜索'
 | animation | 是否需要默认的搜索框显示动画 | Boolean | true
 | animation | 是否需要默认的搜索框显示动画 | Boolean | true
-| customClass | 自定义 class | String | ' '
+| customClass | 自定义 class | String | ''
+| searchIconSize | Search 图标的尺寸 | String | '20px'
+| searchIconColor | Search 图标的颜色 | String | '#2e2d2d'
+| searchBtnIconSize | 搜索按钮图标的尺寸 | String | '20px'
+| searchBtnIconColor | 搜索按钮图标的颜色 | String | '#2e2d2d'
+| clearIconSize | 清空按钮图标的尺寸 | String | '15px'
+| clearIconColor | 清空按钮图标的颜色 | String | '#2e2d2d'
 
 
 ## Event
 ## Event
 
 

+ 3 - 10
src/packages/searchbar/searchbar.scss

@@ -9,23 +9,16 @@
 	    background-color: $light-color;
 	    background-color: $light-color;
 	    border-radius: 20px;
 	    border-radius: 20px;
 	    form {
 	    form {
+			display:flex;
+			align-items:center;
 	    	position: relative;
 	    	position: relative;
 	    	margin-right: 10px;
 	    	margin-right: 10px;
-	    	.nut-icon {
-	    		float: left;
-	    		margin: 8px 0 0 10px;
-	    	}
 	    	.close-icon {
 	    	.close-icon {
 	    		display: none;
 	    		display: none;
 	    		&.show {
 	    		&.show {
-	    			display: inline-block;
+	    			display: inline-flex;
 	    		}
 	    		}
 	    	}
 	    	}
-	    	.nut-icon-circle-cross {
-	    		position: absolute;
-	    		right: 5px;
-	    		top: 0;
-	    	}
 	    }
 	    }
 	    i {
 	    i {
 	    	display: inline-block;
 	    	display: inline-block;

+ 27 - 4
src/packages/searchbar/searchbar.vue

@@ -2,7 +2,7 @@
     <div :class="['nut-searchbar',customClass ? customClass : '']">
     <div :class="['nut-searchbar',customClass ? customClass : '']">
     	<div class="search-input" :class="[animation ? 'nut-search-ani':'',inputFocusAnimation?'focus':'']">
     	<div class="search-input" :class="[animation ? 'nut-search-ani':'',inputFocusAnimation?'focus':'']">
 	    	<form action="" id="input-form" @submit="submitFun">
 	    	<form action="" id="input-form" @submit="submitFun">
-	    		<nut-icon type="search" v-if="hasIcon" width="20" height="20"></nut-icon>
+	    		<nut-icon type="search" v-if="hasIcon" :size="searchIconSize" :color="searchIconColor"></nut-icon>
 	    		<input type="text"
 	    		<input type="text"
 	    		v-model="value"
 	    		v-model="value"
 	    		:placeholder="placeText || nutTranslate('lang.searchbar.placeText')"
 	    		:placeholder="placeText || nutTranslate('lang.searchbar.placeText')"
@@ -12,18 +12,17 @@
 	    		>
 	    		>
 	    		<span class="close-icon" :class="hasCloseIcon ? 'show':''"
 	    		<span class="close-icon" :class="hasCloseIcon ? 'show':''"
 	    		@click="clearInput">
 	    		@click="clearInput">
-	    			<nut-icon type="circle-cross" width="15" height="15"></nut-icon>
+	    			<nut-icon type="circle-cross" :size="clearIconSize" :color="clearIconColor"></nut-icon>
 	    		</span>
 	    		</span>
 	    	</form>
 	    	</form>
     	</div>
     	</div>
     	<a href="javascript:;" class="btn-search" v-if="hasSearchButton" @click="submitFun">
     	<a href="javascript:;" class="btn-search" v-if="hasSearchButton" @click="submitFun">
     		<span v-if="hasTextButton">{{textInfo || nutTranslate('lang.searchbar.textInfo')}}</span>
     		<span v-if="hasTextButton">{{textInfo || nutTranslate('lang.searchbar.textInfo')}}</span>
-    		<nut-icon type="search" v-else width="20" height="20"></nut-icon>
+    		<nut-icon type="search" v-else :size="searchBtnIconSize" :color="searchBtnIconColor"></nut-icon>
     	</a>
     	</a>
     </div>
     </div>
 </template>
 </template>
 <script>
 <script>
-
 import nuticon from "../icon/icon.vue";
 import nuticon from "../icon/icon.vue";
 import locale from "../../mixins/locale";
 import locale from "../../mixins/locale";
 export default {
 export default {
@@ -34,6 +33,30 @@ export default {
     		type: Boolean,
     		type: Boolean,
     		default: false
     		default: false
     	},
     	},
+		searchIconSize: {
+			type: String,
+			default: '20px'
+		},
+		searchIconColor: {
+			type: String,
+			default: '#2e2d2d'
+		},
+		searchBtnIconSize: {
+			type: String,
+			default: '20px'
+		},
+		searchBtnIconColor: {
+			type: String,
+			default: '#2e2d2d'
+		},
+		clearIconSize:{
+			type: String,
+			default: '15px'
+		},
+		clearIconColor: {
+			type: String,
+			default: '#2e2d2d'
+		},
     	placeText: {
     	placeText: {
 			type: String
 			type: String
 		},
 		},