codecamp

Mint UI 搜索框-Search

搜索框,可显示搜索结果列表。

引入

import { Search } from 'mint-ui';

Vue.component(Search.name, Search);

例子

基础用法

<mt-search v-model="value"></mt-search>

设置显示文字

<mt-search
  v-model="value"
  cancel-text="取消"
  placeholder="搜索">
</mt-search>

带搜索结果

<mt-search v-model="value" :result.sync="result"></mt-search>

自定义搜索结果

<mt-search v-model="value">
  <mt-cell
    v-for="item in result"
    :title="item.title"
    :value="item.value">
  </mt-cell>
</mt-search>

API

参数 说明 类型 可选值 默认值
value 搜索结果绑定值 String
cancel-text 取消按钮文字 String 取消
placeholder 搜索框占位内容 String 搜索
result 搜索结果列表 Array
autofocus 自动聚焦 Boolean - false
show 始终显示搜索列表 Boolean - false

Slot

name 描述
- 自定义搜索结果列表


Mint UI 面板- Tab Container
Mint UI 开关-Switch
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }