1 Star 9 Fork 4

hihopeorg / ohos-miniprogram-rate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

ohos-miniprogram-rate

简介

ohos-miniprogram-rate是一实现星星评分功能库。

效果展示:

png

安装教程

  1. 参考安装教程 如何安装OpenHarmony npm包
  2. 安装命令如下:
npm install @ohos/miniprogram_rate --save

使用说明:

第一步: 在hml文件中引入组件;

<element name="hw-rate" src="../../../default/miniprogram-rate/miniprogram_dev/index.hml"></element>

第二步:创建组件节点:

    <hw-rate value="{{2.5}}" allow-half="{{true}}" length="{{5}}" disabled="{{false}}" @change="rateChange"></hw-rate>
  • 注意:导入请求入口js文件时需要根据自己的项目路径;具体详细使用方法可查看项目的案例。
Props
name description type default value
value 选中的星星数 Number 0
placeholder 星星占位符 Number 0
allowHalf 是否可半星 Boolean true
disabled 是否禁用选择 Boolean false
length 星星个数 Number 5
events
name description parameters
change 改变了星星 改变的数值

接口说明

  1. 根据传入的值刷新星星 _refreshValues(newV);
  2. 根据传入的值刷新占位符 _refreshPlaceholders(newV)
  3. 生成最终要显示的星星数量数组 _generateArray(value)
  4. 点击选中星星 choose(e)
  5. 设置值 setVal(v)
  6. 判断是否为整数 isPositiveIntegerNumber(num)

兼容性

支持OpenHarmony API version 8 及以上版本

目录结构

|---- ohos-miniprogram-rate
|     |---- entry  # 示例代码文件夹
|     |---- miniprogram-rate  # miniprogram-rate库文件夹
│           ├----common # 框架代码目录
│               ├----miniprogram_dev # 框架代码目录
│                 ├----index.html # 评分ui库


└─resources # 资源文件
|     |---- README.MD  # 安装使用方法  

贡献代码

使用过程中发现任何问题都可以提 Issue 给我们,当然,我们也非常欢迎你给我们发 PR

开源协议

本项目基于 MIT License ,请自由地享受和参与开源。

MIT License Copyright (c) 2019 林浩裕 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

评分组件 展开 收起
JavaScript 等 2 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/hihopeorg/ohos-miniprogram-rate.git
git@gitee.com:hihopeorg/ohos-miniprogram-rate.git
hihopeorg
ohos-miniprogram-rate
ohos-miniprogram-rate
master

搜索帮助