1.3.24 • Published 5 years ago

vesper-ui v1.3.24

Weekly downloads
5
License
ISC
Repository
-
Last release
5 years ago

引入组件库

npm i --save @mizlicai/mz-ui
import mzui from '@mizlicai/mz-ui'
import '@mizlicai/mz-ui/dist/css/mz-ui.css'

Vue.use(mzui) // 注册组件到全局

组件使用说明

loading

在屏幕中间生成一个loading状态

this.$loading.open(String) // 打开loading 可加文字
this.$loading.close() // 关闭loading

toast

在屏幕中间生成一个白色字黑色半透明背景提示

this.$toast.open(String) // 生成toast 可加文字
this.$toast.open({text: '文字', icon: '是否加icon', iconSize: '同icon控件size', time: '指定时间消失'})
this.$toast.close() // 关闭toast,非手动关闭情况下 默认2秒自动消失

alert

在屏幕中间生成一个带标题/文字/1(确定)到2个按钮(确定,取消)的提示框

cmd mode:

this.$alert({
  title: String, // 标题
  text: Array || String, // 文字
  okTxt: String, // 确定按钮文字,默认“确定”
  quitTxt: String, // 取消按钮文案,默认“取消”
  btns: Number, // 几个按钮,目前支持1|2个按钮,默认1个
  okCb: Function, // 确定的回调
  quitCb: Function // 取消的回调
  type: String // 样式类型 默认风格或ios风格
  closeBtn: Boolean || String // 是否有关闭按钮 若有 内容为"bottom"关闭按钮则在底部 默认在右上角
  mode: String // 生成模式 template:模版模式 cmd:命令模版
})

template mode:

<v-alert ref="alert" title="" text="" okTxt="" quitTxt="" btns="" type="" closeBtn @ok="" @quit=""><slot></slot></v-alert>

template mode 调用:

this.$refs.alert.open()

button

生成一个可点击或不可点击的可定制多种样式的按钮

example:

<v-button type="" size="" icon="" href="" disabled loading inline circle @click="">button</v-button>
属性说明类型默认值
type按钮类型,可选值为primary/success/warning/errorstring-
size按钮大小,可选值为xl/lg/md/sm/xsstringmd
href可添加跳转链接stringjavascript:;
icon添加icon按钮,暂无string-
loading是否加载中(true则显示加载icon)booleanfalse
disabled是否不可用booleanfalse
inline是否行内元素booleanfalse
circle是否全圆角booleanfalse
onclick点击事件function-

icon

生成一个基于iconfont的icon图标

example:

<v-icon icon="" type="" size=""></v-icon>
属性说明类型默认值
typeicon颜色类型,可选值为normal/light/default/success/warning/errorstringnormal
sizeicon大小,可选值为xl/lg/md/sm/xsstringmd
icon对应的icon图标string-

input

生成一个可输入或不可输入内容的可定制多种样式的输入框

example:

<v-input type="" status="" size="" value="" label="" maxlength="" placeholder="" btn="" icon="" enterSubmit focused disabled loading inline circle number @click="" @blur="" @focus="" @input="" @enter="" @submit=""></v-input>
属性说明类型默认值
typeinput类型,可选值为text/password/number/tel/searchstringtext
btnTypeinput附带的button类型,可选值为normal/default/primary/success/warning/error/customstringdefault
btn是否有附带button,btn显示的文字string-
statusinput状态,可选值为success/warning/errorstring-
sizeinput大小,可选值为xl/lg/md/sm/xsstringmd
valueinput的valuestring-
iconinput的iconstring-
labelinput的labelstring-
maxlengthinput的最大长度string,number-
inlinelabel是否在行内booleanfalse
placeholderinput的placeholderstring-
circle是否全圆角booleanfalse
focused是否获取焦点booleanfalse
disabled是否不可用booleanfalse
number是否校验输入是numberbooleanfalse
enterSubmit是否enter事件触发提交booleanfalse
onclick点击事件function-
onblur失焦事件function-
onfocus获得焦点事件function-

nav

生成可定制的导航

example:

<v-nav title="" backTxt="" closeTxt="" optionTxt="" @backCb="" @closeCb="" optionCb="" canClose canBack border>
  <div slot="right"></div> // 定制右侧内容
</v-nav>
属性说明类型默认值
title导航标题string-
backTxt导航返回的文字string-
closeTxt导航关闭的文字string关闭
optionTxt导航右侧的文字string-
backCb点击返回的回调function-
closeCb点击关闭的回调function-
optionCb点击右侧的回调,如自定义则需自行绑定事件function-
canBack是否可以返回booleanfalse
canClose是否可以关闭booleanfalse
border是否有底部边框booleanfalse

tabs

生成tab标签页

example:

<v-tabs v-model="" @tabsClick="" @tabsChange="">
  <v-tabs-pane label="" name="">
    <div></div>
  </v-tabs-pane>
</v-tabs>
属性说明类型默认值
tabsClick点击tab的标题回调function-
tabsChangetab切换之后的回调function-

tabs-pane

生成tab标签页的选项卡

属性说明类型默认值
label选项卡的标题string-
name选项卡的名字,用作标识选项卡,如未指定,则会使用选项卡的index来标识string-

item-group

生成一个item的列表

example:

 <v-item-group title="" align="left||right" type="radio||checkbox" v-model="" @itemChange="">
  <v-icon icon="success" size="sm" slot="title"></v-icon> // title旁的内容插槽
  <v-item value="1" label="" caption="">
  <v-icon icon="success" class="icon" slot="left"></v-icon> // item 主题内容的旁的内容插槽 有left/content/right3个类型 分别对应主体内容的3个位置
  </v-item>
</v-item-group>
属性说明类型默认值
titlegroup的标题string-
typegroup的形式,默认无,可为radio/checkbox模式,通过v-model获取返回值,数据为item设置的value值,checkbox返回值为arraystring-
align配合type使用,可设置type的位置left/rightstring-
itemChangevalue变化时触发functon-

item

生成一个item

属性说明类型默认值
labelitem的标题string-
captionitem的补充信息string-
valueitem的值string-

agree-item

生成一个agree的item

example:

<v-agree-item v-model="" @itemChange="">xxx<a href="https://www.xxx.com/">xxx</a></v-agree-item>
属性说明类型默认值
itemChangevalue变化时触发functon-

steps

生成一个步骤的列表

example:

 <v-steps :current="" direction="horizontal||vertical(default)"  type="icon||number(default)">
  <v-step label="1" caption="step1"></v-step>
  <v-step label="2" caption="step2"></v-step>
  <v-step status="error" label="3" caption="step3"></v-step>
  <v-step label="4" caption="step4"></v-step>
</v-steps>
属性说明类型默认值
current当前的步骤,从1开始计数number1
direction排列模式,horizontal 横向/vertical(default)竖向string-
type图标的模式 icon 图标/number(default)) 数字string-

step

生成一个步骤项

属性说明类型默认值
labelstep的标题string-
captionstep的补充信息string-
statusstep的状态,目前只有error,配合父级type="icon"使用string-

开发指引

组件文件结构

-组件名
  -src
    -模版文件/css/图片
  -index.js // index.js作为统一出口

样式

公共样式在style文件夹统一定义 组件样式一般写在模版文件.vue中或在组件src文件夹自行定义

目前采用sass语法,单位使用px

css-loader已添加px2rem,在标准设计稿750px宽度情况下,可直接按设计稿px设置尺寸,px会自动编译为rem

rem方案为:设计稿基准宽度750px/基准font-size单位为100,即375px手机的html标签的font-size50px

1.3.24

5 years ago

1.2.1

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago