tree: 5eef46122a7776d43ccf632395e92493d4c16e8b [path history] [tgz]
  1. index.js
  2. index.vue
  3. package.json
  4. README.md
  5. README_cn.md
  6. type.js
packages/wxc-searchbar/README.md

wxc-searchbar

Search bar

Rule

  • Under the navigation bar.
  • Exit the activation state with the cancel button

Demo

    

Code Example

<template>
  <div class="container">
    <div class="demo">
      <text class="value-text">base search bar</text>
      <wxc-searchbar ref="wxc-searchbar"
                     @wxcSearchbarCancelClicked="wxcSearchbarCancelClicked"
                     @wxcSearchbarInputReturned="wxcSearchbarInputReturned"
                     @wxcSearchbarInputOnInput="wxcSearchbarInputOnInput"
                     @wxcSearchbarCloseClicked="wxcSearchbarCloseClicked"
                     @wxcSearchbarInputOnFocus="wxcSearchbarInputOnFocus"
                     @wxcSearchbarInputOnBlur="wxcSearchbarInputOnBlur"></wxc-searchbar>
      <text class="value-text">{{value}}</text>
    </div>
    <div class="demo demo1">
      <text class="value-text">input disabled</text>
      <wxc-searchbar disabled="true" @wxcSearchbarInputDisabledClicked="searchbarInputDisabledOnclick"></wxc-searchbar>
    </div>
    <div class="demo demo1">
      <text class="value-text">has dep</text>
      <wxc-searchbar disabled="true"
                     placeholder="type to search"
                     mod="hasDep"
                     dep-name="hangzhou"
                     @wxcSearchbarDepChooseClicked="wxcSearchbarDepChooseClicked"
                     @wxcSearchbarInputDisabledClicked="wxcSearchbarInputDisabledClicked"></wxc-searchbar>
    </div>
  </div>
</template>
<script>
  import { WxcSearchbar } from 'weex-ui'
  export default {
    components: { WxcSearchbar },
    data: () => ({
      value: ''
    }),
    methods: {
      wxcSearchbarInputOnFocus () {
      },
      wxcSearchbarInputOnBlur () {
      },
      wxcSearchbarInputReturned (){
      },
      wxcSearchbarCloseClicked () {
      },
      wxcSearchbarInputOnInput (e) {
        this.value = e.value;
      },
      wxcSearchbarCancelClicked () {
      },
      wxcSearchbarInputDisabledClicked () {
      },
      wxcSearchbarDepChooseClicked () {
      }
    }
  };
</script>

More details can be found in here

API

PropTypeRequiredDefaultDescription
modStringNdefaultsearch bar mode default/hasDep
placeholderStringN搜索input placeholder
cancel-labelStringN取消 cancel button label
input-typeStringNtexttext,password,url,email,tel
return-key-typeStringNdefaultthe keybord returen key type support default/go/next/search/send/done
autofocusBooleanNfalseinput auto focus
default-valueStringN-default value
disabledBooleanNfalsewhether is been disabled
always-show-cancelBooleanNfalsewhether to show cancel button
dep-nameStringN杭州dep name when mode="hasDep"
themeStringNgraysearch bar theme gray/yellow
bar-styleObjectN{}Use when theme is not satisfied

Event

// Specific use can refer to the above demo, do not need to be able to not use.

Manual

<wxc-searchbar ref="wxcSearchbar"></wxc-searchbar>
// this.$refs.wxcSearchbar.setValue("SET");
// this.$refs.wxcSearchbar.autoBlur();