0.0.6 • Published 6 years ago

jim-ui v0.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

jui

Practical UI for Vue.js

Inspired by Semantic-ui and Element-ui

image

为什么做这个UI

通常,开发Vue.js的项目时,UI框架首选是 饿了么的Element UI。

其中,表单这一块经常用,而Element UI的表单太繁琐,这就是出发点。

为了方便使用,最终表单的校验方式同样使用了async-validator

安装

由于jui这个名字已经被注册,所以在npm注册的名字是jim-ui

npm install jim-ui

项目规划

第一阶段:完成组件:(2017.11.22已完成)

  • Button 按钮
  • Input 输入框
  • Radio 单选框
  • Checkbox 复选框
  • Toggle 开关
  • Form 表单

第二阶段:完善Form相关的组件,包含:

  • DropDown 选择器
  • DatePicker 日期选择器

第三阶段:继续完善其他组件:

  • Upload 上传
  • Loading 加载状态
  • Modal 弹框

(...未完待续)

表单用法

template部分:

<j-form :formData="data" :errorData="error" ref="form" :rules="rules">

  <j-form-item label="账号" prop="name">
    <j-input></j-input>
  </j-form-item>
  
  <j-form-item label="密码" prop="password">
    <j-input type="password"></j-input>
  </j-form-item>
  
  <j-form-item>
    <j-button @click="submit">submit</j-button>
  </j-form-item>
  
</j-form>

JavaScript逻辑部分:

export default {
  data() {
    return {
      data: {},
      rules: {},
      error: {}
    }
  },
  methods: {
    submit() {
      this.$refs.form.validate((data) => {
        console.log(data)
      })
    }
  }
}

组件

form

参数说明类型可选值默认值
label-position标签文本的位置stringleft,rightright
error-template默认的错误模板string-prop不能为空
formData表单数据object--
rules验证规则(async-validator)object--
errorData错误信息object--

form-item

参数说明类型可选值默认值
prop字段属性string--
label标签文本string--
type数据类型string-text
required是否必填booleantrue,falsetrue
show-message是否显示错误信息booleantrue,falsetrue
labelWidth标签的宽度string-80px
contentWidth内容的宽度string-160px

button

参数说明类型可选值默认值
type类型string-text
plain朴素风格booleantrue,falsefalse
disable不可点击状态booleantrue,falsefalse
loading加载状态booleantrue,falsefalse
nativeType原生类型string-button

input

参数说明类型可选值默认值
type类型string-text
value数值string/number--
readonly是否只读booleantrue,falsefalse
disable不可使用状态booleantrue,falsefalse
loading加载状态booleantrue,falsefalse
prefixIcon前置图标string--
suffixIcon后置图标string--
placeholder原生属性string--
name原生属性string--
max原生属性string--
min原生属性string--
step原生属性string--
autofocus原生属性string--
form原生属性string--
disabled原生属性string--
autoComplete原生属性string--
focus获取焦点触发事件function--
blur失去焦点触发事件function--
change数值改变时触发事件function--

radio

参数说明类型可选值默认值
name原生属性string--
readonly是否只读booleantrue,falsefalse
checked是否已选择booleantrue,falsefalse

radio-group

参数说明类型可选值默认值
options选项array--
value数值string/number--

checkbox

参数说明类型可选值默认值
name原生属性string--
readonly是否只读booleantrue,falsefalse
checked是否已选择booleantrue,falsefalse

checkbox-group

参数说明类型可选值默认值
options选项array--
value数值string/number--

toggle

参数说明类型可选值默认值
name原生属性string--
checked是否已选择booleantrue,falsefalse

dropdown

参数说明类型可选值默认值
name原生属性string--
options选项array--
defaultText默认文案string-请选择

loading

参数说明类型可选值默认值
type图标类型stringrotate-plane、sk-circle、sk-fading-circle、double-bounce、rect、cube、bouncerotate-plane
loading是否正在加载booleantrue,falsefalse
mask遮罩booleantrue,falsetrue
noText是否显示文案booleantrue,falsefalse
text文案string-正在加载...
0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago