0.0.5 • Published 2 years ago

chris-ui v0.0.5

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

Chris—UI

本ui框架针对于钉钉小程序快速开发

该项目尚处于开发起步阶段,感谢支持

This ui framework is aimed at the rapid development of DingTalk applet

This project is still in the initial stage of development, thanks for your support

Popup 弹出菜单

.json 示例代码

{
 "defaultTitle": "Popup",
 "usingComponents": {
        "popup": "chris-ui/Com/popup/index"
    }
}

.axml 示例代码

<view>
 <view class="btn-container">
   <button onTap="onTopBtnTap">弹出popup</button>
 </view>
 <popup show="{{showTop}}" position="top" onClose="onPopupClose">
   <view style="height: 200px; background: #fff; display: flex; justify-content: center; align-items: center;">
       hello world
   </view>
 </popup>
</view>

.js 示例代码

Page({
 data: {
   showTop: false,
 },
 onTopBtnTap() {
   this.setData({
     showTop: true,
   });
 },
 onPopupClose() {
   this.setData({
     showTop: false,
   });
 },
});

属性说明

属性类型必填描述
classNameStringfalse自定义 class。
showBooleanfalse是否显示菜单。
animationBooleanfalse是否开启动画。
maskBooleantrue是否显示 mask,不显示时点击外部不会触发 onClose。
positionStringtrue控制从什么方向弹出菜单,bottom 表示底部,left 表示左侧,top 表示顶部,right 表示右侧。
disableScrollBooleanfalse展示 mask 时是否禁止页面滚动。
zIndexNumberfalse定义 popup 的层级。

Card卡片

.json 示例代码

{
 "defaultTitle": "card",
 "usingComponents": {
        "card": "chris-ui/Com/card/index"
    }
}

.axml 示例代码

  <card title="{{title}}" rightIcon="{{true}}">
    <view>
      测试名称:测试名称
    </view>
  </card>

.js 示例代码

Page({
 data: {
   title: '卡片名称',
 },
});

属性说明

属性类型必填描述
titleStringfalse卡片的标题
rightIconBooleanfalse是否显示右侧箭头
classNameStringfalse自定义 class。

SearchBar 搜索框

json 示例代码

{
 "defaultTitle": "Search-bar",
 "usingComponents": {
   "search-bar": "chris-ui/Com/search-bar/index"
 }
}

.axml 示例代码

  <search-bar
    value="{{value}}"
    focus="{{true}}"
    disabled="{{false}}"
    maxLength="{{20}}"
    showVoice="{{showVoice}}"
    placeholder="搜索"
    onInput="handleInput"
    onClear="handleClear"
    onCancel="handleCancel"
    onSubmit="handleSubmit"
    cancelvalue="{{cancelvalue}}"
    showCancelButton="{{false}}" />

.js 示例代码

Page({
  data: {
    value: '',
    showVoice: false,
    cancelvalue:'重置'
  },
  handleInput(value) {
    this.setData({
      value,
    });
  },
  handleClear() {
    this.setData({
      value: '',
    });
  },
  handleCancel() {
    this.setData({
      value: '',
    });
  },
  onChange(e) {
    this.setData({
      showVoice: e.detail.value,
    });
  },
});

属性说明

属性类型默认值描述
valueString搜索框的当前值。
placeholderStringplaceholder。
focusBooleanfalse自动获取光标。
showVoiceBooleanfalse是否展示voice图标。
onInput(value: String) => void键盘输入时触发。
onClear(val: String) => void点击 clear 图标触发。
onFocus() => void获取焦点时触发。
onBlur() => void失去焦点时触发。
onCancel() => void点击取消时触发。
onVoiceClick() => void点击 voice 图标时触发。
onSubmit(val: String) => void点击键盘的 enter 时触发。
disabledBooleanfalse设置禁用。
maxLengthNumber最多允许输入的字符个数。
showCancelButtonBooleanfalse是否一直显示取消按钮。
cancelvalueString取消右侧取消按钮的文字
borderColorString#B7282D搜索输入框边框色。
enableNativeBooleanfalse如为 false 可处理 fixed 定位后输入框内容闪动的问题。
controlledBooleantrue组件是否受控。
0.0.5

2 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago