浏览代码

style(searchbar): 样式优化

richard1015 4 年之前
父节点
当前提交
aa2f3dfd61

+ 6 - 1
src/packages/__VUE/searchbar/demo.vue

@@ -19,7 +19,12 @@
     </nut-searchbar>
     </nut-searchbar>
 
 
     <h2>更改输入框内部及外部的背景样式</h2>
     <h2>更改输入框内部及外部的背景样式</h2>
-    <nut-searchbar v-model="searchValue4" background="red" input-background="#fff"> </nut-searchbar>
+    <nut-searchbar
+      v-model="searchValue4"
+      background="linear-gradient(to right, #9866F0, #EB4D50)"
+      input-background="#fff"
+    >
+    </nut-searchbar>
 
 
     <h2>显示全部 icon</h2>
     <h2>显示全部 icon</h2>
     <nut-searchbar v-model="searchValue5">
     <nut-searchbar v-model="searchValue5">

+ 108 - 109
src/packages/__VUE/searchbar/doc.md

@@ -1,4 +1,4 @@
-# Searchbar组件
+# Searchbar 搜索栏
 
 
 ### 介绍
 ### 介绍
 
 
@@ -14,7 +14,6 @@ import { SearchBar, Icon } from '@nutui/nutui';
 // taro
 // taro
 import { SearchBar, Icon } from '@nutui/nutui-taro';
 import { SearchBar, Icon } from '@nutui/nutui-taro';
 
 
-
 const app = createApp();
 const app = createApp();
 app.use(SearchBar).use(Icon);
 app.use(SearchBar).use(Icon);
 ```    
 ```    
@@ -26,158 +25,158 @@ app.use(SearchBar).use(Icon);
 ```
 ```
 
 
 ```javascript
 ```javascript
-  import { toRefs, reactive } from 'vue';
-
-  export default {
-    setup() {
-      const state = reactive({
-        searchValue: ""
-      });
-
-      return {
-        ...toRefs(state),
-      };
-    }
+import { toRefs, reactive } from 'vue';
+
+export default {
+  setup() {
+    const state = reactive({
+      searchValue: ""
+    });
+
+    return {
+      ...toRefs(state),
+    };
   }
   }
+}
 ```
 ```
 
 
 ### 搜索事件监听
 ### 搜索事件监听
 
 
 ```html
 ```html
-  <nut-searchbar v-model="searchValue" @search="search"></nut-searchbar>
+<nut-searchbar v-model="searchValue" @search="search"></nut-searchbar>
 ```
 ```
 
 
 ```javascript
 ```javascript
-  import { toRefs, reactive } from 'vue';
-  import { Toast } from '@nutui/nutui';
-
-  export default {
-    setup() {
-      const state = reactive({
-        searchValue: ""
-      });
-
-      const search = function () {
-        Toast.text('搜索触发');
-      };
-
-      return {
-        ...toRefs(state),
-        search,
-      };
-    }
+import { toRefs, reactive } from 'vue';
+import { Toast } from '@nutui/nutui';
+
+export default {
+  setup() {
+    const state = reactive({
+      searchValue: ""
+    });
+
+    const search = function () {
+      Toast.text('搜索触发');
+    };
+
+    return {
+      ...toRefs(state),
+      search,
+    };
   }
   }
+}
 ```
 ```
 
 
 ### 显示搜索 icon
 ### 显示搜索 icon
 
 
 ```html
 ```html
-  <nut-searchbar v-model="searchValue">
-    <template v-slot:leftin>
-      <nut-icon size="14" name="search2"></nut-icon>
-    </template>
-  </nut-searchbar>
+<nut-searchbar v-model="searchValue">
+  <template v-slot:leftin>
+    <nut-icon size="14" name="search2"></nut-icon>
+  </template>
+</nut-searchbar>
 ```
 ```
 
 
 ```javascript
 ```javascript
-  import { toRefs, reactive } from 'vue';
-  import { Icon } from '@nutui/nutui';
-
-  export default {
-    setup() {
-      const state = reactive({
-        searchValue: ""
-      });
-
-      return {
-        ...toRefs(state),
-      };
-    }
+import { toRefs, reactive } from 'vue';
+import { Icon } from '@nutui/nutui';
+
+export default {
+  setup() {
+    const state = reactive({
+      searchValue: ""
+    });
+
+    return {
+      ...toRefs(state),
+    };
   }
   }
+}
 ```
 ```
 
 
 ### 右侧添加搜索文字
 ### 右侧添加搜索文字
 
 
 ```html
 ```html
-  <nut-searchbar v-model="searchValue">
-    <template v-slot:rightout>
-      搜索
-    </template>
-  </nut-searchbar>
+<nut-searchbar v-model="searchValue">
+  <template v-slot:rightout>
+    搜索
+  </template>
+</nut-searchbar>
 ```
 ```
 
 
 ```javascript
 ```javascript
-  import { toRefs, reactive } from 'vue';
-
-  export default {
-    setup() {
-      const state = reactive({
-        searchValue: ""
-      });
-
-      return {
-        ...toRefs(state),
-      };
-    }
+import { toRefs, reactive } from 'vue';
+
+export default {
+  setup() {
+    const state = reactive({
+      searchValue: ""
+    });
+
+    return {
+      ...toRefs(state),
+    };
   }
   }
+}
 ```
 ```
     <h2>更改输入框内部及外部的背景样式</h2>
     <h2>更改输入框内部及外部的背景样式</h2>
 
 
 ### 更改输入框内部及外部的背景样式
 ### 更改输入框内部及外部的背景样式
 
 
 ```html
 ```html
-  <nut-searchbar v-model="searchValue" background="red" input-background="#fff"></nut-searchbar> 
+<nut-searchbar v-model="searchValue4" background="linear-gradient(to right, #9866F0, #EB4D50)" input-background="#fff"> </nut-searchbar>
 ```
 ```
 
 
 ```javascript
 ```javascript
-  import { toRefs, reactive } from 'vue';
-
-  export default {
-    setup() {
-      const state = reactive({
-        searchValue: ""
-      });
-
-      return {
-        ...toRefs(state),
-      };
-    }
+import { toRefs, reactive } from 'vue';
+
+export default {
+  setup() {
+    const state = reactive({
+      searchValue: ""
+    });
+
+    return {
+      ...toRefs(state),
+    };
   }
   }
+}
 ```
 ```
 ### 显示全部 icon
 ### 显示全部 icon
 
 
 ```html
 ```html
-  <nut-searchbar v-model="searchValue">
-    <template v-slot:leftout>
-      <nut-icon @click="clickLeft" size="20" name="left"></nut-icon>
-    </template>
-    <template v-slot:leftin>
-      <nut-icon size="14" name="search2"></nut-icon>
-    </template>
-    <template v-slot:rightin>
-      <nut-icon size="20" name="photograph"></nut-icon>
-    </template>
-    <template v-slot:rightout>
-      <nut-icon size="20" name="message"></nut-icon>
-    </template>
-  </nut-searchbar> 
+<nut-searchbar v-model="searchValue">
+  <template v-slot:leftout>
+    <nut-icon @click="clickLeft" size="20" name="left"></nut-icon>
+  </template>
+  <template v-slot:leftin>
+    <nut-icon size="14" name="search2"></nut-icon>
+  </template>
+  <template v-slot:rightin>
+    <nut-icon size="20" name="photograph"></nut-icon>
+  </template>
+  <template v-slot:rightout>
+    <nut-icon size="20" name="message"></nut-icon>
+  </template>
+</nut-searchbar> 
 ```
 ```
 
 
-```javascript
-  import { toRefs, reactive } from 'vue';
-  import { Icon } from '@nutui/nutui';
-
-  export default {
-    setup() {
-      const state = reactive({
-        searchValue: ""
-      });
-
-      return {
-        ...toRefs(state),
-      };
-    }
+``` javascript
+import { toRefs, reactive } from 'vue';
+import { Icon } from '@nutui/nutui';
+
+export default {
+  setup() {
+    const state = reactive({
+      searchValue: ""
+    });
+
+    return {
+      ...toRefs(state),
+    };
   }
   }
+}
 ```
 ```
     
     
 ### Props
 ### Props

+ 10 - 1
src/packages/__VUE/searchbar/index.scss

@@ -20,11 +20,20 @@
       display: flex;
       display: flex;
       position: relative;
       position: relative;
       width: 100%;
       width: 100%;
+      > taro-form-core {
+        width: 100%;
+      }
       form {
       form {
         display: flex;
         display: flex;
         align-items: center;
         align-items: center;
         width: 100%;
         width: 100%;
       }
       }
+      input {
+        width: 100%;
+        height: 100%;
+        min-width: 214px;
+        padding-left: 4px;
+      }
       .nut-searchbar__input-clear {
       .nut-searchbar__input-clear {
         display: flex;
         display: flex;
         justify-content: center;
         justify-content: center;
@@ -84,6 +93,6 @@
   &__right-search-icon {
   &__right-search-icon {
     margin-left: 16px;
     margin-left: 16px;
     font-size: 14px;
     font-size: 14px;
-    color: rgba(26, 26, 26, 1);
+    color: $searchbar-right-out-color;
   }
   }
 }
 }

+ 1 - 1
src/packages/__VUE/searchbar/index.taro.vue

@@ -21,7 +21,7 @@
           />
           />
         </form>
         </form>
         <view @click="handleClear" class="nut-searchbar__input-clear" v-if="clearable" v-show="modelValue.length > 0">
         <view @click="handleClear" class="nut-searchbar__input-clear" v-if="clearable" v-show="modelValue.length > 0">
-          <nut-icon name="mask-close" size="12px"></nut-icon>
+          <nut-icon name="circle-close" size="12" color="#555"></nut-icon>
         </view>
         </view>
       </view>
       </view>
       <view v-if="$slots.rightin" class="nut-searchbar__search-icon nut-searchbar__iptright-sarch-icon">
       <view v-if="$slots.rightin" class="nut-searchbar__search-icon nut-searchbar__iptright-sarch-icon">

+ 1 - 1
src/packages/__VUE/searchbar/index.vue

@@ -21,7 +21,7 @@
           />
           />
         </form>
         </form>
         <view @click="handleClear" class="nut-searchbar__input-clear" v-if="clearable" v-show="modelValue.length > 0">
         <view @click="handleClear" class="nut-searchbar__input-clear" v-if="clearable" v-show="modelValue.length > 0">
-          <nut-icon name="mask-close" size="12px"></nut-icon>
+          <nut-icon name="circle-close" size="12" color="#555"></nut-icon>
         </view>
         </view>
       </view>
       </view>
       <view v-if="$slots.rightin" class="nut-searchbar__search-icon nut-searchbar__iptright-sarch-icon">
       <view v-if="$slots.rightin" class="nut-searchbar__search-icon nut-searchbar__iptright-sarch-icon">

+ 1 - 0
src/packages/styles/variables.scss

@@ -360,6 +360,7 @@ $tabs-vertical-titles-width: 100px !default;
 // searchbar
 // searchbar
 $searchbar-background: $white !default;
 $searchbar-background: $white !default;
 $searchbar-input-background: #f7f7f7 !default;
 $searchbar-input-background: #f7f7f7 !default;
+$searchbar-right-out-color: $black !default;
 
 
 @import './mixins/index';
 @import './mixins/index';
 @import './animation/index';
 @import './animation/index';

+ 10 - 8
src/sites/mobile-taro/vue/src/feedback/pages/searchbar/index.vue

@@ -19,7 +19,12 @@
     </nut-searchbar>
     </nut-searchbar>
 
 
     <h2>更改输入框内部及外部的背景样式</h2>
     <h2>更改输入框内部及外部的背景样式</h2>
-    <nut-searchbar v-model="searchValue4" background="red" input-background="#fff"> </nut-searchbar>
+    <nut-searchbar
+      v-model="searchValue4"
+      background="linear-gradient(to right, #9866F0, #EB4D50)"
+      input-background="#fff"
+    >
+    </nut-searchbar>
 
 
     <h2>显示全部 icon</h2>
     <h2>显示全部 icon</h2>
     <nut-searchbar v-model="searchValue5">
     <nut-searchbar v-model="searchValue5">
@@ -41,10 +46,7 @@
 
 
 <script lang="ts">
 <script lang="ts">
 import { toRefs, reactive } from 'vue';
 import { toRefs, reactive } from 'vue';
-import { createComponent } from '../../utils/create';
-import { Toast } from '@/packages/nutui.vue';
-const { createDemo } = createComponent('searchbar');
-export default createDemo({
+export default {
   props: {},
   props: {},
   setup() {
   setup() {
     const state = reactive({
     const state = reactive({
@@ -57,11 +59,11 @@ export default createDemo({
     });
     });
 
 
     const search = function (e: any) {
     const search = function (e: any) {
-      Toast.text('搜索触发');
+      console.log('搜索触发');
     };
     };
 
 
     const clickLeft = function () {
     const clickLeft = function () {
-      Toast.text('点击回退按钮');
+      console.log('点击回退按钮');
     };
     };
 
 
     return {
     return {
@@ -70,7 +72,7 @@ export default createDemo({
       ...toRefs(state)
       ...toRefs(state)
     };
     };
   }
   }
-});
+};
 </script>
 </script>
 
 
 <style lang="scss" scoped></style>
 <style lang="scss" scoped></style>