usage
npm install zsui --save
import zsui from 'zsui'import 'zsui/dist/style.css'import 'zsui/reset.css'
API
input
配置:
props: disbaled: //Boolean 是否禁止, type: //String (类型: 如'text', 'number') placeholder: //String, 默认'请输入' readonly: //Boolean 是否只读, maxlength: //Number 最大字数, minlength: //Number 最小字数, value: //[String, number] event: @blur: //失焦事件 @focus: //聚焦事件 @input: //输入 @change: //绑定值发生变化
示例:
select
配置:
props: value: //默认为null, optionList: //下拉选项,需提供label值与value值 label: //, value: // disabled: //Boolean 是否禁用, readonly: //Boolean 选择输入框是否只读, 默认为只读,如需要可输入功能,则设为false, filterable: //Boolean 是否可搜索,若需要此功能,需将readonly属性设为false event: @change: //绑定值发生变化
示例:
基本使用:
备注:重置时,将绑定值设为null
输入:
搜索:
paging
示例:
button
options
name | type | default |
---|---|---|
text | String | '点击' |
type | String | 'blue'('blue','white','disable') |
widthType | String | 'normal'('normal','mini') |
icon | String | (iconfont名称) |
event
name | description |
---|---|
click | type为'disable'不触发 |
example
toast
this//简易写法this$toastthis$toastthis$toast
confirm
this
alert
this//简易写法(需要传入标题和副标题)this$alertthis$alertthis$alert
dialog
options
name | type | default |
---|---|---|
show | Boolean | false |
title | String | '这是一个对话框' |
enterText | String | '确定' |
enterAlign | String | 'right' |
slot
name | description |
---|---|
main | dialog主区域 |
event
name | description |
---|---|
enter | 确定按钮回调 |
close | 取消按钮回调 |
cascader
配置:
props: data: Array //下拉选项 value: Array //可设置默认值 placeholder: String disabled: //Boolean, allowClear: //Boolean, 是否有删除按钮, 默认为true event: @change: //绑定值发生变化时触发
示例:
data: label: 'test1' value: 'test1' children: label: 'test11' value: 'test11' label: 'test12' value: 'test12' label: 'test2' value: 'test2' children: label: 'test21' value: 'test21' label: 'test22' value: 'test22' children: label: 'test221' value: '221' val: 'test2' 'test22' 'test221' { //val为新值}
breadcrumb
示例:
招生信息 学生信息
picshow
示例:
imgUrl: "图片地址" //默认图片为 “暂无图片”imgshow: false
tabbar
示例:
tabData: label: 'aaa' value: 1 click: true label: 'bbb' value: 2 click: false label: 'ccc' value: 3 click: false { console}
radio
示例:
选项一选项一
radioGroup
选项一 选项二
tooltip
示例:
- placement设置共有 "top" "bottom" "left" "right"四个方向,配合 "start" "end"两个位置
- 具名为content的slot内为tooltip中展示的内容
修改
main