邵佳豪
2 years ago
699 changed files with 8881 additions and 68048 deletions
@ -1,12 +0,0 @@
|
||||
{ |
||||
"name": "Jinan_app", |
||||
"lockfileVersion": 2, |
||||
"requires": true, |
||||
"packages": { |
||||
"node_modules/@escook/request-miniprogram": { |
||||
"version": "0.2.1", |
||||
"resolved": "https://registry.npmmirror.com/@escook/request-miniprogram/-/request-miniprogram-0.2.1.tgz", |
||||
"integrity": "sha512-ueWV5YsaEm/ycQZuEjMiA88GFMhfBQSjy9GrP9omy4xAQajkGTbYIlnhzsDfWzRPmRC1fKmAiKMrCVcgS+SHcQ==" |
||||
} |
||||
} |
||||
} |
@ -1,99 +0,0 @@
|
||||
## 安装 |
||||
|
||||
```bash |
||||
npm install @escook/request-miniprogram |
||||
``` |
||||
|
||||
## 导入 |
||||
|
||||
```js |
||||
// 按需导入 $http 对象 |
||||
import { $http } from '@escook/request-miniprogram' |
||||
|
||||
// 将按需导入的 $http 挂载到 wx 顶级对象之上,方便全局调用 |
||||
wx.$http = $http |
||||
|
||||
// 在 uni-app 项目中,可以把 $http 挂载到 uni 顶级对象之上,方便全局调用 |
||||
uni.$http = $http |
||||
``` |
||||
|
||||
## 使用 |
||||
|
||||
### 支持的请求方法 |
||||
|
||||
```js |
||||
// 发起 GET 请求,data 是可选的参数对象 |
||||
$http.get(url, data?) |
||||
|
||||
// 发起 POST 请求,data 是可选的参数对象 |
||||
$http.post(url, data?) |
||||
|
||||
// 发起 PUT 请求,data 是可选的参数对象 |
||||
$http.put(url, data?) |
||||
|
||||
// 发起 DELETE 请求,data 是可选的参数对象 |
||||
$http.delete(url, data?) |
||||
``` |
||||
|
||||
### 配置请求根路径 |
||||
|
||||
```js |
||||
$http.baseUrl = 'https://www.example.com' |
||||
``` |
||||
|
||||
### 请求拦截器 |
||||
|
||||
```js |
||||
// 请求开始之前做一些事情 |
||||
$http.beforeRequest = function (options) { |
||||
// do somethimg... |
||||
} |
||||
``` |
||||
|
||||
例 1,展示 loading 效果: |
||||
|
||||
```js |
||||
// 请求开始之前做一些事情 |
||||
$http.beforeRequest = function (options) { |
||||
wx.showLoading({ |
||||
title: '数据加载中...', |
||||
}) |
||||
} |
||||
``` |
||||
|
||||
例 2,自定义 header 请求头: |
||||
|
||||
```js |
||||
// 请求开始之前做一些事情 |
||||
$http.beforeRequest = function (options) { |
||||
if (options.url.indexOf('/home/catitems') !== -1) { |
||||
options.header = { |
||||
'X-Test': 'AAA', |
||||
} |
||||
} |
||||
} |
||||
``` |
||||
|
||||
### 响应拦截器 |
||||
|
||||
```js |
||||
// 请求完成之后做一些事情 |
||||
$http.afterRequest = function () { |
||||
// do something... |
||||
} |
||||
``` |
||||
|
||||
例如,隐藏 loading 效果: |
||||
|
||||
```js |
||||
// 请求完成之后做一些事情 |
||||
$http.afterRequest = function () { |
||||
wx.hideLoading() |
||||
} |
||||
``` |
||||
|
||||
## 开源协议 |
||||
|
||||
![MIT](https://img.shields.io/badge/License-MIT-blue) |
||||
|
||||
**enjoy!** |
@ -1,73 +0,0 @@
|
||||
class Request { |
||||
constructor(options = {}) { |
||||
// 请求的根路径
|
||||
this.baseUrl = options.baseUrl || '' |
||||
// 请求的 url 地址
|
||||
this.url = options.url || '' |
||||
// 请求方式
|
||||
this.method = 'GET' |
||||
// 请求的参数对象
|
||||
this.data = null |
||||
// header 请求头
|
||||
this.header = options.header || {} |
||||
this.beforeRequest = null |
||||
this.afterRequest = null |
||||
} |
||||
|
||||
get(url, data = {}) { |
||||
this.method = 'GET' |
||||
this.url = this.baseUrl + url |
||||
this.data = data |
||||
return this._() |
||||
} |
||||
|
||||
post(url, data = {}) { |
||||
this.method = 'POST' |
||||
this.url = this.baseUrl + url |
||||
this.data = data |
||||
return this._() |
||||
} |
||||
|
||||
put(url, data = {}) { |
||||
this.method = 'PUT' |
||||
this.url = this.baseUrl + url |
||||
this.data = data |
||||
return this._() |
||||
} |
||||
|
||||
delete(url, data = {}) { |
||||
this.method = 'DELETE' |
||||
this.url = this.baseUrl + url |
||||
this.data = data |
||||
return this._() |
||||
} |
||||
|
||||
_() { |
||||
// 清空 header 对象
|
||||
this.header = {} |
||||
// 请求之前做一些事
|
||||
this.beforeRequest && typeof this.beforeRequest === 'function' && this.beforeRequest(this) |
||||
// 发起请求
|
||||
return new Promise((resolve, reject) => { |
||||
let weixin = wx |
||||
// 适配 uniapp
|
||||
if ('undefined' !== typeof uni) { |
||||
weixin = uni |
||||
} |
||||
weixin.request({ |
||||
url: this.url, |
||||
method: this.method, |
||||
data: this.data, |
||||
header: this.header, |
||||
success: (res) => { resolve(res) }, |
||||
fail: (err) => { reject(err) }, |
||||
complete: (res) => { |
||||
// 请求完成以后做一些事情
|
||||
this.afterRequest && typeof this.afterRequest === 'function' && this.afterRequest(res) |
||||
} |
||||
}) |
||||
}) |
||||
} |
||||
} |
||||
|
||||
export const $http = new Request() |
@ -1,23 +0,0 @@
|
||||
{ |
||||
"name": "@escook/request-miniprogram", |
||||
"version": "0.2.1", |
||||
"description": "基于 Promise 的小程序网路请求库", |
||||
"main": "miniprogram_dist/index.js", |
||||
"miniprogram": "miniprogram_dist", |
||||
"scripts": {}, |
||||
"keywords": [ |
||||
"request", |
||||
"miniprogram", |
||||
"wx", |
||||
"weixin" |
||||
], |
||||
"repository": { |
||||
"type": "git", |
||||
"url": "git@github.com:liulongbin1314/request-miniprogram.git" |
||||
}, |
||||
"bugs": { |
||||
"url": "https://github.com/liulongbin1314/request-miniprogram/issues" |
||||
}, |
||||
"author": "LiuLongBin", |
||||
"license": "MIT" |
||||
} |
@ -1,246 +0,0 @@
|
||||
## 2.4.3-20220505(2022-05-05) |
||||
- 秋云图表组件 修复开启canvas2d后将series赋值为空数组显示加载图标时,再次赋值后画布闪动的bug |
||||
- 秋云图表组件 修复升级hbx最新版后ECharts的highlight方法报错的bug |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.gridEval,数据点位网格抽希,默认1 |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.axisLabel, 是否显示刻度点值,默认false |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.axisLabelTofix,刻度点值小数位数,默认0 |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointShow,是否显示末端刻度圆点,默认false |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointRadius,刻度圆点的半径,默认3 |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.labelPointColor,刻度圆点的颜色,默认#cccccc |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.linearType,渐变色类型,可选值"none"关闭渐变,"custom"开启渐变 |
||||
- uCharts.js 雷达图新增参数opts.extra.radar.customColor,自定义渐变颜色,数组类型对应series的数组长度以匹配不同series颜色的不同配色方案,例如["#FA7D8D", "#EB88E2"] |
||||
- uCharts.js 雷达图优化支持series.textColor、series.textSize属性 |
||||
- uCharts.js 柱状图中温度计式图标,优化支持全圆角类型,修复边框有缝隙的bug,详见官网【演示】中的温度计图表 |
||||
- uCharts.js 柱状图新增参数opts.extra.column.activeWidth,当前点击柱状图的背景宽度,默认一个单元格单位 |
||||
- uCharts.js 混合图增加opts.extra.mix.area.gradient 区域图是否开启渐变色 |
||||
- uCharts.js 混合图增加opts.extra.mix.area.opacity 区域图透明度,默认0.2 |
||||
- uCharts.js 饼图、圆环图、玫瑰图、漏斗图,增加opts.series[0].data[i].labelText,自定义标签文字,避免formatter格式化的繁琐,详见官网【演示】中的饼图 |
||||
- uCharts.js 饼图、圆环图、玫瑰图、漏斗图,增加opts.series[0].data[i].labelShow,自定义是否显示某一个指示标签,避免因饼图类别太多导致标签重复或者居多导致图形变形的问题,详见官网【演示】中的饼图 |
||||
- uCharts.js 增加opts.series[i].legendText/opts.series[0].data[i].legendText(与series.name同级)自定义图例显示文字的方法 |
||||
- uCharts.js 优化X轴、Y轴formatter格式化方法增加形参,统一为fromatter:function(value,index,opts){} |
||||
- uCharts.js 修复横屏模式下无法使用双指缩放方法的bug |
||||
- uCharts.js 修复当只有一条数据或者多条数据值相等的时候Y轴自动计算的最大值错误的bug |
||||
- 【官网模板】增加外部自定义图例与图表交互的例子,[点击跳转](https://www.ucharts.cn/v2/#/layout/info?id=2) |
||||
|
||||
## 注意:非unimodules 版本如因更新 hbx 至 3.4.7 导致报错如下,请到码云更新非 unimodules 版本组件,[点击跳转](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6) |
||||
> Error in callback for immediate watcher "uchartsOpts": "SyntaxError: Unexpected token u in JSON at position 0" |
||||
## 2.4.2-20220421(2022-04-21) |
||||
- 秋云图表组件 修复HBX升级3.4.6.20220420版本后echarts报错的问题 |
||||
## 2.4.2-20220420(2022-04-20) |
||||
## 重要!此版本uCharts新增了很多功能,修复了诸多已知问题 |
||||
- 秋云图表组件 新增onzoom开启双指缩放功能(仅uCharts),前提需要直角坐标系类图表类型,并且ontouch为true、opts.enableScroll为true,详见实例项目K线图 |
||||
- 秋云图表组件 新增optsWatch是否监听opts变化,关闭optsWatch后,动态修改opts不会触发图表重绘 |
||||
- 秋云图表组件 修复开启canvas2d功能后,动态更新数据后画布闪动的bug |
||||
- 秋云图表组件 去除directory属性,改为自动获取echarts.min.js路径(升级不受影响) |
||||
- 秋云图表组件 增加getImage()方法及@getImage事件,通过ref调用getImage()方法获,触发@getImage事件获取当前画布的base64图片文件流。 |
||||
- 秋云图表组件 支付宝、字节跳动、飞书、快手小程序支持开启canvas2d同层渲染设置。 |
||||
- 秋云图表组件 新增加【非uniCloud】版本组件,避免有些不需要uniCloud的使用组件发布至小程序需要提交隐私声明问题,请到码云[【非uniCloud版本】](https://gitee.com/uCharts/uCharts/tree/master/uni-app/uCharts-%E7%BB%84%E4%BB%B6),或npm[【非uniCloud版本】](https://www.npmjs.com/package/@qiun/uni-ucharts)下载使用。 |
||||
- uCharts.js 新增dobuleZoom双指缩放功能 |
||||
- uCharts.js 新增山峰图type="mount",数据格式为饼图类格式,不需要传入categories,具体详见新版官网在线演示 |
||||
- uCharts.js 修复折线图当数据中存在null时tooltip报错的bug |
||||
- uCharts.js 修复饼图类当画布比较小时自动计算的半径是负数报错的bug |
||||
- uCharts.js 统一各图表类型的series.formatter格式化方法的形参为(val, index, series, opts),方便格式化时有更多参数可用 |
||||
- uCharts.js 标记线功能增加labelText自定义显示文字,增加labelAlign标签显示位置(左侧或右侧),增加标签显示位置微调labelOffsetX、labelOffsetY |
||||
- uCharts.js 修复条状图当数值很小时开启圆角后样式错误的bug |
||||
- uCharts.js 修复X轴开启disabled后,X轴仍占用空间的bug |
||||
- uCharts.js 修复X轴开启滚动条并且开启rotateLabel后,X轴文字与滚动条重叠的bug |
||||
- uCharts.js 增加X轴rotateAngle文字旋转自定义角度,取值范围(-90至90) |
||||
- uCharts.js 修复地图文字标签层级显示不正确的bug |
||||
- uCharts.js 修复饼图、圆环图、玫瑰图当数据全部为0的时候不显示数据标签的bug |
||||
- uCharts.js 修复当opts.padding上边距为0时,Y轴顶部刻度标签位置不正确的bug |
||||
|
||||
## 另外我们还开发了各大原生小程序组件,已发布至码云和npm |
||||
[https://gitee.com/uCharts/uCharts](https://gitee.com/uCharts/uCharts) |
||||
[https://www.npmjs.com/~qiun](https://www.npmjs.com/~qiun) |
||||
|
||||
## 对于原生uCharts文档我们已上线新版官方网站,详情点击下面链接进入官网 |
||||
[https://www.uCharts.cn/v2/](https://www.ucharts.cn/v2/) |
||||
## 2.3.7-20220122(2022-01-22) |
||||
## 重要!使用vue3编译,请使用cli模式并升级至最新依赖,HbuilderX编译需要使用3.3.8以上版本 |
||||
- uCharts.js 修复uni-app平台组件模式使用vue3编译到小程序报错的bug。 |
||||
## 2.3.7-20220118(2022-01-18) |
||||
## 注意,使用vue3的前提是需要3.3.8.20220114-alpha版本的HBuilder! |
||||
## 2.3.67-20220118(2022-01-18) |
||||
- 秋云图表组件 组件初步支持vue3,全端编译会有些问题,具体详见下面修改: |
||||
1. 小程序端运行时,在uni_modules文件夹的qiun-data-charts.js中搜索 new uni_modules_qiunDataCharts_js_sdk_uCharts_uCharts.uCharts,将.uCharts去掉。 |
||||
2. 小程序端发行时,在uni_modules文件夹的qiun-data-charts.js中搜索 new e.uCharts,将.uCharts去掉,变为 new e。 |
||||
3. 如果觉得上述步骤比较麻烦,如果您的项目只编译到小程序端,可以修改u-charts.js最后一行导出方式,将 export default uCharts;变更为 export default { uCharts: uCharts }; 这样变更后,H5和App端的renderjs会有问题,请开发者自行选择。(此问题非组件问题,请等待DC官方修复Vue3的小程序端) |
||||
## 2.3.6-20220111(2022-01-11) |
||||
- 秋云图表组件 修改组件 props 属性中的 background 默认值为 rgba(0,0,0,0) |
||||
## 2.3.6-20211201(2021-12-01) |
||||
- uCharts.js 修复bar条状图开启圆角模式时,值很小时圆角渲染错误的bug |
||||
## 2.3.5-20211014(2021-10-15) |
||||
- uCharts.js 增加vue3的编译支持(仅原生uCharts,qiun-data-charts组件后续会支持,请关注更新) |
||||
## 2.3.4-20211012(2021-10-12) |
||||
- 秋云图表组件 修复 mac os x 系统 mouseover 事件丢失的 bug |
||||
## 2.3.3-20210706(2021-07-06) |
||||
- uCharts.js 增加雷达图开启数据点值(opts.dataLabel)的显示 |
||||
## 2.3.2-20210627(2021-06-27) |
||||
- 秋云图表组件 修复tooltipCustom个别情况下传值不正确报错TypeError: Cannot read property 'name' of undefined的bug |
||||
## 2.3.1-20210616(2021-06-16) |
||||
- uCharts.js 修复圆角柱状图使用4角圆角时,当数值过大时不正确的bug |
||||
## 2.3.0-20210612(2021-06-12) |
||||
- uCharts.js 【重要】uCharts增加nvue兼容,可在nvue项目中使用gcanvas组件渲染uCharts,[详见码云uCharts-demo-nvue](https://gitee.com/uCharts/uCharts) |
||||
- 秋云图表组件 增加tapLegend属性,是否开启图例点击交互事件 |
||||
- 秋云图表组件 getIndex事件中增加返回uCharts实例中的opts参数,以便在页面中调用参数 |
||||
- 示例项目 pages/other/other.vue增加app端自定义tooltip的方法,详见showOptsTooltip方法 |
||||
## 2.2.1-20210603(2021-06-03) |
||||
- uCharts.js 修复饼图、圆环图、玫瑰图,当起始角度不为0时,tooltip位置不准确的bug |
||||
- uCharts.js 增加温度计式柱状图开启顶部半圆形的配置 |
||||
## 2.2.0-20210529(2021-05-29) |
||||
- uCharts.js 增加条状图type="bar" |
||||
- 示例项目 pages/ucharts/ucharts.vue增加条状图的demo |
||||
## 2.1.7-20210524(2021-05-24) |
||||
- uCharts.js 修复大数据量模式下曲线图不平滑的bug |
||||
## 2.1.6-20210523(2021-05-23) |
||||
- 秋云图表组件 修复小程序端开启滚动条更新数据后滚动条位置不符合预期的bug |
||||
## 2.1.5-2021051702(2021-05-17) |
||||
- uCharts.js 修复自定义Y轴min和max值为0时不能正确显示的bug |
||||
## 2.1.5-20210517(2021-05-17) |
||||
- uCharts.js 修复Y轴自定义min和max时,未按指定的最大值最小值显示坐标轴刻度的bug |
||||
## 2.1.4-20210516(2021-05-16) |
||||
- 秋云图表组件 优化onWindowResize防抖方法 |
||||
- 秋云图表组件 修复APP端uCharts更新数据时,清空series显示loading图标后再显示图表,图表抖动的bug |
||||
- uCharts.js 修复开启canvas2d后,x轴、y轴、series自定义字体大小未按比例缩放的bug |
||||
- 示例项目 修复format-e.vue拼写错误导致app端使用uCharts渲染图表 |
||||
## 2.1.3-20210513(2021-05-13) |
||||
- 秋云图表组件 修改uCharts变更chartData数据为updateData方法,支持带滚动条的数据动态打点 |
||||
- 秋云图表组件 增加onWindowResize防抖方法 fix by ど誓言,如尘般染指流年づ |
||||
- 秋云图表组件 H5或者APP变更chartData数据显示loading图表时,原数据闪现的bug |
||||
- 秋云图表组件 props增加errorReload禁用错误点击重新加载的方法 |
||||
- uCharts.js 增加tooltip显示category(x轴对应点位)标题的功能,opts.extra.tooltip.showCategory,默认为false |
||||
- uCharts.js 修复mix混合图只有柱状图时,tooltip的分割线显示位置不正确的bug |
||||
- uCharts.js 修复开启滚动条,图表在拖动中动态打点,滚动条位置不正确的bug |
||||
- uCharts.js 修复饼图类数据格式为echarts数据格式,series为空数组报错的bug |
||||
- 示例项目 修改uCharts.js更新到v2.1.2版本后,@getIndex方法获取索引值变更为e.currentIndex.index |
||||
- 示例项目 pages/updata/updata.vue增加滚动条拖动更新(数据动态打点)的demo |
||||
- 示例项目 pages/other/other.vue增加errorReload禁用错误点击重新加载的demo |
||||
## 2.1.2-20210509(2021-05-09) |
||||
秋云图表组件 修复APP端初始化时就传入chartData或lacaldata不显示图表的bug |
||||
## 2.1.1-20210509(2021-05-09) |
||||
- 秋云图表组件 变更ECharts的eopts配置在renderjs内执行,支持在config-echarts.js配置文件内写function配置。 |
||||
- 秋云图表组件 修复APP端报错Prop being mutated: "onmouse"错误的bug。 |
||||
- 秋云图表组件 修复APP端报错Error: Not Found:Page[6][-1,27] at view.umd.min.js:1的bug。 |
||||
## 2.1.0-20210507(2021-05-07) |
||||
- 秋云图表组件 修复初始化时就有数据或者数据更新的时候loading加载动画闪动的bug |
||||
- uCharts.js 修复x轴format方法categories为字符串类型时返回NaN的bug |
||||
- uCharts.js 修复series.textColor、legend.fontColor未执行全局默认颜色的bug |
||||
## 2.1.0-20210506(2021-05-06) |
||||
- 秋云图表组件 修复极个别情况下报错item.properties undefined的bug |
||||
- 秋云图表组件 修复极个别情况下关闭加载动画reshow不起作用,无法显示图表的bug |
||||
- 示例项目 pages/ucharts/ucharts.vue 增加时间轴折线图(type="tline")、时间轴区域图(type="tarea")、散点图(type="scatter")、气泡图demo(type="bubble")、倒三角形漏斗图(opts.extra.funnel.type="triangle")、金字塔形漏斗图(opts.extra.funnel.type="pyramid") |
||||
- 示例项目 pages/format-u/format-u.vue 增加X轴format格式化示例 |
||||
- uCharts.js 升级至v2.1.0版本 |
||||
- uCharts.js 修复 玫瑰图面积模式点击tooltip位置不正确的bug |
||||
- uCharts.js 修复 玫瑰图点击图例,只剩一个类别显示空白的bug |
||||
- uCharts.js 修复 饼图类图点击图例,其他图表tooltip位置某些情况下不准的bug |
||||
- uCharts.js 修复 x轴为矢量轴(时间轴)情况下,点击tooltip位置不正确的bug |
||||
- uCharts.js 修复 词云图获取点击索引偶尔不准的bug |
||||
- uCharts.js 增加 直角坐标系图表X轴format格式化方法(原生uCharts.js用法请使用formatter) |
||||
- uCharts.js 增加 漏斗图扩展配置,倒三角形(opts.extra.funnel.type="triangle"),金字塔形(opts.extra.funnel.type="pyramid") |
||||
- uCharts.js 增加 散点图(opts.type="scatter")、气泡图(opts.type="bubble") |
||||
- 后期计划 完善散点图、气泡图,增加markPoints标记点,增加横向条状图。 |
||||
## 2.0.0-20210502(2021-05-02) |
||||
- uCharts.js 修复词云图获取点击索引不正确的bug |
||||
## 2.0.0-20210501(2021-05-01) |
||||
- 秋云图表组件 修复QQ小程序、百度小程序在关闭动画效果情况下,v-for循环使用图表,显示不正确的bug |
||||
## 2.0.0-20210426(2021-04-26) |
||||
- 秋云图表组件 修复QQ小程序不支持canvas2d的bug |
||||
- 秋云图表组件 修复钉钉小程序某些情况点击坐标计算错误的bug |
||||
- uCharts.js 增加 extra.column.categoryGap 参数,柱状图类每个category点位(X轴点)柱子组之间的间距 |
||||
- uCharts.js 增加 yAxis.data[i].titleOffsetY 参数,标题纵向偏移距离,负数为向上偏移,正数向下偏移 |
||||
- uCharts.js 增加 yAxis.data[i].titleOffsetX 参数,标题横向偏移距离,负数为向左偏移,正数向右偏移 |
||||
- uCharts.js 增加 extra.gauge.labelOffset 参数,仪表盘标签文字径向便宜距离,默认13px |
||||
## 2.0.0-20210422-2(2021-04-22) |
||||
秋云图表组件 修复 formatterAssign 未判断 args[key] == null 的情况导致栈溢出的 bug |
||||
## 2.0.0-20210422(2021-04-22) |
||||
- 秋云图表组件 修复H5、APP、支付宝小程序、微信小程序canvas2d模式下横屏模式的bug |
||||
## 2.0.0-20210421(2021-04-21) |
||||
- uCharts.js 修复多行图例的情况下,图例在上方或者下方时,图例float为左侧或者右侧时,第二行及以后的图例对齐方式不正确的bug |
||||
## 2.0.0-20210420(2021-04-20) |
||||
- 秋云图表组件 修复微信小程序开启canvas2d模式后,windows版微信小程序不支持canvas2d模式的bug |
||||
- 秋云图表组件 修改非uni_modules版本为v2.0版本qiun-data-charts组件 |
||||
## 2.0.0-20210419(2021-04-19) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
||||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; |
||||
## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 |
||||
## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
||||
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) |
||||
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! </font> |
||||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
- uCharts.js 修复混合图中柱状图单独设置颜色不生效的bug |
||||
- uCharts.js 修复多Y轴单独设置fontSize时,开启canvas2d后,未对应放大字体的bug |
||||
## 2.0.0-20210418(2021-04-18) |
||||
- 秋云图表组件 增加directory配置,修复H5端history模式下如果发布到二级目录无法正确加载echarts.min.js的bug |
||||
## 2.0.0-20210416(2021-04-16) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
||||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; |
||||
## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 |
||||
## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
||||
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) |
||||
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! </font> |
||||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
- 秋云图表组件 修复APP端某些情况下报错`Not Found Page`的bug,fix by 高级bug开发技术员 |
||||
- 示例项目 修复APP端v-for循环某些情况下报错`Not Found Page`的bug,fix by 高级bug开发技术员 |
||||
- uCharts.js 修复非直角坐标系tooltip提示窗右侧超出未变换方向显示的bug |
||||
## 2.0.0-20210415(2021-04-15) |
||||
- 秋云图表组件 修复H5端发布到二级目录下echarts无法加载的bug |
||||
- 秋云图表组件 修复某些情况下echarts.off('finished')移除监听事件报错的bug |
||||
## 2.0.0-20210414(2021-04-14) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
||||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,如仍不好用,请重启电脑; |
||||
## 如果是cli项目,请尝试清理node_modules,重新install,还不行就删除项目,再重新install。 |
||||
## 此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
||||
## 其他图表不显示问题详见[常见问题选项卡](https://demo.ucharts.cn) |
||||
## <font color=#FF0000> 新手请先完整阅读帮助文档及常见问题3遍,右侧蓝色按钮示例项目请看2遍! </font> |
||||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## [图表组件在项目中的应用参见 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
- 秋云图表组件 修复H5端在cli项目下ECharts引用地址错误的bug |
||||
- 示例项目 增加ECharts的formatter用法的示例(详见示例项目format-e.vue) |
||||
- uCharts.js 增加圆环图中心背景色的配置extra.ring.centerColor |
||||
- uCharts.js 修复微信小程序安卓端柱状图开启透明色后显示不正确的bug |
||||
## 2.0.0-20210413(2021-04-13) |
||||
- 秋云图表组件 修复百度小程序多个图表真机未能正确获取根元素dom尺寸的bug |
||||
- 秋云图表组件 修复百度小程序横屏模式方向不正确的bug |
||||
- 秋云图表组件 修改ontouch时,@getTouchStart@getTouchMove@getTouchEnd的触发条件 |
||||
- uCharts.js 修复饼图类数据格式series属性不生效的bug |
||||
- uCharts.js 增加时序区域图 详见示例项目中ucharts.vue |
||||
## 2.0.0-20210412-2(2021-04-12) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
||||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX。如仍不好用,请重启电脑,此问题已于DCloud官方确认,HBuilderX下个版本会修复。 |
||||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
- 秋云图表组件 修复uCharts在APP端横屏模式下不能正确渲染的bug |
||||
- 示例项目 增加ECharts柱状图渐变色、圆角柱状图、横向柱状图(条状图)的示例 |
||||
## 2.0.0-20210412(2021-04-12) |
||||
- 秋云图表组件 修复created中判断echarts导致APP端无法识别,改回mounted中判断echarts初始化 |
||||
- uCharts.js 修复2d模式下series.textOffset未乘像素比的bug |
||||
## 2.0.0-20210411(2021-04-11) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧绿色【使用HBuilderX导入插件】即可使用,示例项目请点击右侧蓝色按钮【使用HBuilderX导入示例项目】。 |
||||
## 初次使用如果提示未注册<qiun-data-charts>组件,请重启HBuilderX,并清空小程序开发者工具缓存。 |
||||
## [DEMO演示及在线生成工具(v2.0文档)https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## [图表组件在uniCloudAdmin中的应用 UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
- uCharts.js 折线图区域图增加connectNulls断点续连的功能,详见示例项目中ucharts.vue |
||||
- 秋云图表组件 变更初始化方法为created,变更type2d默认值为true,优化2d模式下组件初始化后dom获取不到的bug |
||||
- 秋云图表组件 修复左右布局时,右侧图表点击坐标错误的bug,修复tooltip柱状图自定义颜色显示object的bug |
||||
## 2.0.0-20210410(2021-04-10) |
||||
- 修复左右布局时,右侧图表点击坐标错误的bug,修复柱状图自定义颜色tooltip显示object的bug |
||||
- 增加标记线及柱状图自定义颜色的demo |
||||
## 2.0.0-20210409(2021-04-08) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧【使用HBuilderX导入插件】即可体验,DEMO演示及在线生成工具(v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
- uCharts.js 修复钉钉小程序百度小程序measureText不准确的bug,修复2d模式下饼图类activeRadius为按比例放大的bug |
||||
- 修复组件在支付宝小程序端点击位置不准确的bug |
||||
## 2.0.0-20210408(2021-04-07) |
||||
- 修复组件在支付宝小程序端不能显示的bug(目前支付宝小程不能点击交互,后续修复) |
||||
- uCharts.js 修复高分屏下柱状图类,圆弧进度条 自定义宽度不能按比例放大的bug |
||||
## 2.0.0-20210407(2021-04-06) |
||||
## v1.0版本已停更,建议转uni_modules版本组件方式调用,点击右侧【使用HBuilderX导入插件】即可体验,DEMO演示及在线生成工具(v2.0文档)[https://demo.ucharts.cn](https://demo.ucharts.cn) |
||||
## 增加 通过tofix和unit快速格式化y轴的demo add by `howcode` |
||||
## 增加 图表组件在uniCloudAdmin中的应用 [UReport数据报表](https://ext.dcloud.net.cn/plugin?id=4651) |
||||
## 2.0.0-20210406(2021-04-05) |
||||
# 秋云图表组件+uCharts v2.0版本同步上线,使用方法详见https://demo.ucharts.cn帮助页 |
||||
## 2.0.0(2021-04-05) |
||||
# 秋云图表组件+uCharts v2.0版本同步上线,使用方法详见https://demo.ucharts.cn帮助页 |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,162 +0,0 @@
|
||||
<template> |
||||
<view class="container loading1"> |
||||
<view class="shape shape1"></view> |
||||
<view class="shape shape2"></view> |
||||
<view class="shape shape3"></view> |
||||
<view class="shape shape4"></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'loading1', |
||||
data() { |
||||
return { |
||||
|
||||
}; |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped="true"> |
||||
.container { |
||||
width: 30px; |
||||
height: 30px; |
||||
position: relative; |
||||
} |
||||
.container.loading1 { |
||||
-webkit-transform: rotate(45deg); |
||||
transform: rotate(45deg); |
||||
} |
||||
|
||||
.container .shape { |
||||
position: absolute; |
||||
width: 10px; |
||||
height: 10px; |
||||
border-radius: 1px; |
||||
} |
||||
.container .shape.shape1 { |
||||
left: 0; |
||||
background-color: #1890FF; |
||||
} |
||||
.container .shape.shape2 { |
||||
right: 0; |
||||
background-color: #91CB74; |
||||
} |
||||
.container .shape.shape3 { |
||||
bottom: 0; |
||||
background-color: #FAC858; |
||||
} |
||||
.container .shape.shape4 { |
||||
bottom: 0; |
||||
right: 0; |
||||
background-color: #EE6666; |
||||
} |
||||
|
||||
.loading1 .shape1 { |
||||
-webkit-animation: animation1shape1 0.5s ease 0s infinite alternate; |
||||
animation: animation1shape1 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation1shape1 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(16px, 16px); |
||||
transform: translate(16px, 16px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation1shape1 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(16px, 16px); |
||||
transform: translate(16px, 16px); |
||||
} |
||||
} |
||||
.loading1 .shape2 { |
||||
-webkit-animation: animation1shape2 0.5s ease 0s infinite alternate; |
||||
animation: animation1shape2 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation1shape2 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-16px, 16px); |
||||
transform: translate(-16px, 16px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation1shape2 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-16px, 16px); |
||||
transform: translate(-16px, 16px); |
||||
} |
||||
} |
||||
.loading1 .shape3 { |
||||
-webkit-animation: animation1shape3 0.5s ease 0s infinite alternate; |
||||
animation: animation1shape3 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation1shape3 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(16px, -16px); |
||||
transform: translate(16px, -16px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation1shape3 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(16px, -16px); |
||||
transform: translate(16px, -16px); |
||||
} |
||||
} |
||||
.loading1 .shape4 { |
||||
-webkit-animation: animation1shape4 0.5s ease 0s infinite alternate; |
||||
animation: animation1shape4 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation1shape4 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-16px, -16px); |
||||
transform: translate(-16px, -16px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation1shape4 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-16px, -16px); |
||||
transform: translate(-16px, -16px); |
||||
} |
||||
} |
||||
|
||||
|
||||
</style> |
@ -1,170 +0,0 @@
|
||||
<template> |
||||
<view class="container loading2"> |
||||
<view class="shape shape1"></view> |
||||
<view class="shape shape2"></view> |
||||
<view class="shape shape3"></view> |
||||
<view class="shape shape4"></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'loading2', |
||||
data() { |
||||
return { |
||||
|
||||
}; |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped="true"> |
||||
.container { |
||||
width: 30px; |
||||
height: 30px; |
||||
position: relative; |
||||
} |
||||
|
||||
.container.loading2 { |
||||
-webkit-transform: rotate(10deg); |
||||
transform: rotate(10deg); |
||||
} |
||||
.container.loading2 .shape { |
||||
border-radius: 5px; |
||||
} |
||||
.container.loading2{ |
||||
-webkit-animation: rotation 1s infinite; |
||||
animation: rotation 1s infinite; |
||||
} |
||||
|
||||
.container .shape { |
||||
position: absolute; |
||||
width: 10px; |
||||
height: 10px; |
||||
border-radius: 1px; |
||||
} |
||||
.container .shape.shape1 { |
||||
left: 0; |
||||
background-color: #1890FF; |
||||
} |
||||
.container .shape.shape2 { |
||||
right: 0; |
||||
background-color: #91CB74; |
||||
} |
||||
.container .shape.shape3 { |
||||
bottom: 0; |
||||
background-color: #FAC858; |
||||
} |
||||
.container .shape.shape4 { |
||||
bottom: 0; |
||||
right: 0; |
||||
background-color: #EE6666; |
||||
} |
||||
|
||||
|
||||
.loading2 .shape1 { |
||||
-webkit-animation: animation2shape1 0.5s ease 0s infinite alternate; |
||||
animation: animation2shape1 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation2shape1 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(20px, 20px); |
||||
transform: translate(20px, 20px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation2shape1 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(20px, 20px); |
||||
transform: translate(20px, 20px); |
||||
} |
||||
} |
||||
.loading2 .shape2 { |
||||
-webkit-animation: animation2shape2 0.5s ease 0s infinite alternate; |
||||
animation: animation2shape2 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation2shape2 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-20px, 20px); |
||||
transform: translate(-20px, 20px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation2shape2 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-20px, 20px); |
||||
transform: translate(-20px, 20px); |
||||
} |
||||
} |
||||
.loading2 .shape3 { |
||||
-webkit-animation: animation2shape3 0.5s ease 0s infinite alternate; |
||||
animation: animation2shape3 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation2shape3 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(20px, -20px); |
||||
transform: translate(20px, -20px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation2shape3 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(20px, -20px); |
||||
transform: translate(20px, -20px); |
||||
} |
||||
} |
||||
.loading2 .shape4 { |
||||
-webkit-animation: animation2shape4 0.5s ease 0s infinite alternate; |
||||
animation: animation2shape4 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation2shape4 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-20px, -20px); |
||||
transform: translate(-20px, -20px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation2shape4 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-20px, -20px); |
||||
transform: translate(-20px, -20px); |
||||
} |
||||
} |
||||
|
||||
</style> |
@ -1,173 +0,0 @@
|
||||
<template> |
||||
<view class="container loading3"> |
||||
<view class="shape shape1"></view> |
||||
<view class="shape shape2"></view> |
||||
<view class="shape shape3"></view> |
||||
<view class="shape shape4"></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'loading3', |
||||
data() { |
||||
return { |
||||
|
||||
}; |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped="true"> |
||||
.container { |
||||
width: 30px; |
||||
height: 30px; |
||||
position: relative; |
||||
} |
||||
|
||||
.container.loading3 { |
||||
-webkit-animation: rotation 1s infinite; |
||||
animation: rotation 1s infinite; |
||||
} |
||||
.container.loading3 .shape1 { |
||||
border-top-left-radius: 10px; |
||||
} |
||||
.container.loading3 .shape2 { |
||||
border-top-right-radius: 10px; |
||||
} |
||||
.container.loading3 .shape3 { |
||||
border-bottom-left-radius: 10px; |
||||
} |
||||
.container.loading3 .shape4 { |
||||
border-bottom-right-radius: 10px; |
||||
} |
||||
|
||||
.container .shape { |
||||
position: absolute; |
||||
width: 10px; |
||||
height: 10px; |
||||
border-radius: 1px; |
||||
} |
||||
.container .shape.shape1 { |
||||
left: 0; |
||||
background-color: #1890FF; |
||||
} |
||||
.container .shape.shape2 { |
||||
right: 0; |
||||
background-color: #91CB74; |
||||
} |
||||
.container .shape.shape3 { |
||||
bottom: 0; |
||||
background-color: #FAC858; |
||||
} |
||||
.container .shape.shape4 { |
||||
bottom: 0; |
||||
right: 0; |
||||
background-color: #EE6666; |
||||
} |
||||
|
||||
.loading3 .shape1 { |
||||
-webkit-animation: animation3shape1 0.5s ease 0s infinite alternate; |
||||
animation: animation3shape1 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation3shape1 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(5px, 5px); |
||||
transform: translate(5px, 5px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation3shape1 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(5px, 5px); |
||||
transform: translate(5px, 5px); |
||||
} |
||||
} |
||||
.loading3 .shape2 { |
||||
-webkit-animation: animation3shape2 0.5s ease 0s infinite alternate; |
||||
animation: animation3shape2 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation3shape2 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-5px, 5px); |
||||
transform: translate(-5px, 5px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation3shape2 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-5px, 5px); |
||||
transform: translate(-5px, 5px); |
||||
} |
||||
} |
||||
.loading3 .shape3 { |
||||
-webkit-animation: animation3shape3 0.5s ease 0s infinite alternate; |
||||
animation: animation3shape3 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation3shape3 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(5px, -5px); |
||||
transform: translate(5px, -5px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation3shape3 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(5px, -5px); |
||||
transform: translate(5px, -5px); |
||||
} |
||||
} |
||||
.loading3 .shape4 { |
||||
-webkit-animation: animation3shape4 0.5s ease 0s infinite alternate; |
||||
animation: animation3shape4 0.5s ease 0s infinite alternate; |
||||
} |
||||
|
||||
@-webkit-keyframes animation3shape4 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-5px, -5px); |
||||
transform: translate(-5px, -5px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation3shape4 { |
||||
from { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
to { |
||||
-webkit-transform: translate(-5px, -5px); |
||||
transform: translate(-5px, -5px); |
||||
} |
||||
} |
||||
</style> |
@ -1,222 +0,0 @@
|
||||
<template> |
||||
<view class="container loading5"> |
||||
<view class="shape shape1"></view> |
||||
<view class="shape shape2"></view> |
||||
<view class="shape shape3"></view> |
||||
<view class="shape shape4"></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'loading5', |
||||
data() { |
||||
return { |
||||
|
||||
}; |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped="true"> |
||||
.container { |
||||
width: 30px; |
||||
height: 30px; |
||||
position: relative; |
||||
} |
||||
|
||||
.container.loading5 .shape { |
||||
width: 15px; |
||||
height: 15px; |
||||
} |
||||
|
||||
.container .shape { |
||||
position: absolute; |
||||
width: 10px; |
||||
height: 10px; |
||||
border-radius: 1px; |
||||
} |
||||
.container .shape.shape1 { |
||||
left: 0; |
||||
background-color: #1890FF; |
||||
} |
||||
.container .shape.shape2 { |
||||
right: 0; |
||||
background-color: #91CB74; |
||||
} |
||||
.container .shape.shape3 { |
||||
bottom: 0; |
||||
background-color: #FAC858; |
||||
} |
||||
.container .shape.shape4 { |
||||
bottom: 0; |
||||
right: 0; |
||||
background-color: #EE6666; |
||||
} |
||||
|
||||
.loading5 .shape1 { |
||||
animation: animation5shape1 2s ease 0s infinite reverse; |
||||
} |
||||
|
||||
@-webkit-keyframes animation5shape1 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, 15px); |
||||
transform: translate(0, 15px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(15px, 15px); |
||||
transform: translate(15px, 15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(15px, 0); |
||||
transform: translate(15px, 0); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation5shape1 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, 15px); |
||||
transform: translate(0, 15px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(15px, 15px); |
||||
transform: translate(15px, 15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(15px, 0); |
||||
transform: translate(15px, 0); |
||||
} |
||||
} |
||||
.loading5 .shape2 { |
||||
animation: animation5shape2 2s ease 0s infinite reverse; |
||||
} |
||||
|
||||
@-webkit-keyframes animation5shape2 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(-15px, 0); |
||||
transform: translate(-15px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-15px, 15px); |
||||
transform: translate(-15px, 15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, 15px); |
||||
transform: translate(0, 15px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation5shape2 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(-15px, 0); |
||||
transform: translate(-15px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-15px, 15px); |
||||
transform: translate(-15px, 15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, 15px); |
||||
transform: translate(0, 15px); |
||||
} |
||||
} |
||||
.loading5 .shape3 { |
||||
animation: animation5shape3 2s ease 0s infinite reverse; |
||||
} |
||||
|
||||
@-webkit-keyframes animation5shape3 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(15px, 0); |
||||
transform: translate(15px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(15px, -15px); |
||||
transform: translate(15px, -15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, -15px); |
||||
transform: translate(0, -15px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation5shape3 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(15px, 0); |
||||
transform: translate(15px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(15px, -15px); |
||||
transform: translate(15px, -15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, -15px); |
||||
transform: translate(0, -15px); |
||||
} |
||||
} |
||||
.loading5 .shape4 { |
||||
animation: animation5shape4 2s ease 0s infinite reverse; |
||||
} |
||||
|
||||
@-webkit-keyframes animation5shape4 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, -15px); |
||||
transform: translate(0, -15px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-15px, -15px); |
||||
transform: translate(-15px, -15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(-15px, 0); |
||||
transform: translate(-15px, 0); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation5shape4 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, -15px); |
||||
transform: translate(0, -15px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-15px, -15px); |
||||
transform: translate(-15px, -15px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(-15px, 0); |
||||
transform: translate(-15px, 0); |
||||
} |
||||
} |
||||
|
||||
</style> |
@ -1,229 +0,0 @@
|
||||
<template> |
||||
<view class="container loading6"> |
||||
<view class="shape shape1"></view> |
||||
<view class="shape shape2"></view> |
||||
<view class="shape shape3"></view> |
||||
<view class="shape shape4"></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'loading6', |
||||
data() { |
||||
return { |
||||
|
||||
}; |
||||
} |
||||
} |
||||
</script> |
||||
<style scoped="true"> |
||||
.container { |
||||
width: 30px; |
||||
height: 30px; |
||||
position: relative; |
||||
} |
||||
|
||||
.container.loading6 { |
||||
-webkit-animation: rotation 1s infinite; |
||||
animation: rotation 1s infinite; |
||||
} |
||||
.container.loading6 .shape { |
||||
width: 12px; |
||||
height: 12px; |
||||
border-radius: 2px; |
||||
} |
||||
.container .shape { |
||||
position: absolute; |
||||
width: 10px; |
||||
height: 10px; |
||||
border-radius: 1px; |
||||
} |
||||
.container .shape.shape1 { |
||||
left: 0; |
||||
background-color: #1890FF; |
||||
} |
||||
.container .shape.shape2 { |
||||
right: 0; |
||||
background-color: #91CB74; |
||||
} |
||||
.container .shape.shape3 { |
||||
bottom: 0; |
||||
background-color: #FAC858; |
||||
} |
||||
.container .shape.shape4 { |
||||
bottom: 0; |
||||
right: 0; |
||||
background-color: #EE6666; |
||||
} |
||||
|
||||
|
||||
.loading6 .shape1 { |
||||
-webkit-animation: animation6shape1 2s linear 0s infinite normal; |
||||
animation: animation6shape1 2s linear 0s infinite normal; |
||||
} |
||||
|
||||
@-webkit-keyframes animation6shape1 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, 18px); |
||||
transform: translate(0, 18px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(18px, 18px); |
||||
transform: translate(18px, 18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(18px, 0); |
||||
transform: translate(18px, 0); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation6shape1 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, 18px); |
||||
transform: translate(0, 18px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(18px, 18px); |
||||
transform: translate(18px, 18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(18px, 0); |
||||
transform: translate(18px, 0); |
||||
} |
||||
} |
||||
.loading6 .shape2 { |
||||
-webkit-animation: animation6shape2 2s linear 0s infinite normal; |
||||
animation: animation6shape2 2s linear 0s infinite normal; |
||||
} |
||||
|
||||
@-webkit-keyframes animation6shape2 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(-18px, 0); |
||||
transform: translate(-18px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-18px, 18px); |
||||
transform: translate(-18px, 18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, 18px); |
||||
transform: translate(0, 18px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation6shape2 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(-18px, 0); |
||||
transform: translate(-18px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-18px, 18px); |
||||
transform: translate(-18px, 18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, 18px); |
||||
transform: translate(0, 18px); |
||||
} |
||||
} |
||||
.loading6 .shape3 { |
||||
-webkit-animation: animation6shape3 2s linear 0s infinite normal; |
||||
animation: animation6shape3 2s linear 0s infinite normal; |
||||
} |
||||
|
||||
@-webkit-keyframes animation6shape3 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(18px, 0); |
||||
transform: translate(18px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(18px, -18px); |
||||
transform: translate(18px, -18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, -18px); |
||||
transform: translate(0, -18px); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation6shape3 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(18px, 0); |
||||
transform: translate(18px, 0); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(18px, -18px); |
||||
transform: translate(18px, -18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(0, -18px); |
||||
transform: translate(0, -18px); |
||||
} |
||||
} |
||||
.loading6 .shape4 { |
||||
-webkit-animation: animation6shape4 2s linear 0s infinite normal; |
||||
animation: animation6shape4 2s linear 0s infinite normal; |
||||
} |
||||
|
||||
@-webkit-keyframes animation6shape4 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, -18px); |
||||
transform: translate(0, -18px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-18px, -18px); |
||||
transform: translate(-18px, -18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(-18px, 0); |
||||
transform: translate(-18px, 0); |
||||
} |
||||
} |
||||
|
||||
@keyframes animation6shape4 { |
||||
0% { |
||||
-webkit-transform: translate(0, 0); |
||||
transform: translate(0, 0); |
||||
} |
||||
25% { |
||||
-webkit-transform: translate(0, -18px); |
||||
transform: translate(0, -18px); |
||||
} |
||||
50% { |
||||
-webkit-transform: translate(-18px, -18px); |
||||
transform: translate(-18px, -18px); |
||||
} |
||||
75% { |
||||
-webkit-transform: translate(-18px, 0); |
||||
transform: translate(-18px, 0); |
||||
} |
||||
} |
||||
</style> |
@ -1,36 +0,0 @@
|
||||
<template> |
||||
<view> |
||||
<Loading1 v-if="loadingType==1"/> |
||||
<Loading2 v-if="loadingType==2"/> |
||||
<Loading3 v-if="loadingType==3"/> |
||||
<Loading4 v-if="loadingType==4"/> |
||||
<Loading5 v-if="loadingType==5"/> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import Loading1 from "./loading1.vue"; |
||||
import Loading2 from "./loading2.vue"; |
||||
import Loading3 from "./loading3.vue"; |
||||
import Loading4 from "./loading4.vue"; |
||||
import Loading5 from "./loading5.vue"; |
||||
export default { |
||||
components:{Loading1,Loading2,Loading3,Loading4,Loading5}, |
||||
name: 'qiun-loading', |
||||
props: { |
||||
loadingType: { |
||||
type: Number, |
||||
default: 2 |
||||
}, |
||||
}, |
||||
data() { |
||||
return { |
||||
|
||||
}; |
||||
}, |
||||
} |
||||
</script> |
||||
|
||||
<style> |
||||
|
||||
</style> |
@ -1,422 +0,0 @@
|
||||
/* |
||||
* uCharts® |
||||
* 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台 |
||||
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
|
||||
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
* 复制使用请保留本段注释,感谢支持开源! |
||||
*
|
||||
* uCharts®官方网站 |
||||
* https://www.uCharts.cn
|
||||
*
|
||||
* 开源地址: |
||||
* https://gitee.com/uCharts/uCharts
|
||||
*
|
||||
* uni-app插件市场地址: |
||||
* http://ext.dcloud.net.cn/plugin?id=271
|
||||
*
|
||||
*/ |
||||
|
||||
// 通用配置项
|
||||
|
||||
// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
|
||||
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; |
||||
|
||||
const cfe = { |
||||
//demotype为自定义图表类型
|
||||
"type": ["pie", "ring", "rose", "funnel", "line", "column", "area", "radar", "gauge","candle","demotype"], |
||||
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型例如最后的"demotype"
|
||||
"categories": ["line", "column", "area", "radar", "gauge", "candle","demotype"], |
||||
//instance为实例变量承载属性,option为eopts承载属性,不要删除
|
||||
"instance": {}, |
||||
"option": {}, |
||||
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
||||
"formatter":{ |
||||
"tooltipDemo1":function(res){ |
||||
let result = '' |
||||
for (let i in res) { |
||||
if (i == 0) { |
||||
result += res[i].axisValueLabel + '年销售额' |
||||
} |
||||
let value = '--' |
||||
if (res[i].data !== null) { |
||||
value = res[i].data |
||||
} |
||||
// #ifdef H5
|
||||
result += '\n' + res[i].seriesName + ':' + value + ' 万元' |
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
result += '<br/>' + res[i].marker + res[i].seriesName + ':' + value + ' 万元' |
||||
// #endif
|
||||
} |
||||
return result; |
||||
}, |
||||
legendFormat:function(name){ |
||||
return "自定义图例+"+name; |
||||
}, |
||||
yAxisFormatDemo:function (value, index) { |
||||
return value + '元'; |
||||
}, |
||||
seriesFormatDemo:function(res){ |
||||
return res.name + '年' + res.value + '元'; |
||||
} |
||||
}, |
||||
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在eopts参数,会将demotype与eopts中option合并后渲染图表。
|
||||
"demotype":{ |
||||
"color": color, |
||||
//在这里填写echarts的option即可
|
||||
|
||||
}, |
||||
//下面是自定义配置,请添加项目所需的通用配置
|
||||
"column": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'axis' |
||||
}, |
||||
"grid": { |
||||
"top": 30, |
||||
"bottom": 50, |
||||
"right": 15, |
||||
"left": 40 |
||||
}, |
||||
"legend": { |
||||
"bottom": 'left', |
||||
}, |
||||
"toolbox": { |
||||
"show": false, |
||||
}, |
||||
"xAxis": { |
||||
"type": 'category', |
||||
"axisLabel": { |
||||
"color": '#666666' |
||||
}, |
||||
"axisLine": { |
||||
"lineStyle": { |
||||
"color": '#CCCCCC' |
||||
} |
||||
}, |
||||
"boundaryGap": true, |
||||
"data": [] |
||||
}, |
||||
"yAxis": { |
||||
"type": 'value', |
||||
"axisTick": { |
||||
"show": false, |
||||
}, |
||||
"axisLabel": { |
||||
"color": '#666666' |
||||
}, |
||||
"axisLine": { |
||||
"lineStyle": { |
||||
"color": '#CCCCCC' |
||||
} |
||||
}, |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'bar', |
||||
"data": [], |
||||
"barwidth": 20, |
||||
"label": { |
||||
"show": true, |
||||
"color": "#666666", |
||||
"position": 'top', |
||||
}, |
||||
}, |
||||
}, |
||||
"line": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'axis' |
||||
}, |
||||
"grid": { |
||||
"top": 30, |
||||
"bottom": 50, |
||||
"right": 15, |
||||
"left": 40 |
||||
}, |
||||
"legend": { |
||||
"bottom": 'left', |
||||
}, |
||||
"toolbox": { |
||||
"show": false, |
||||
}, |
||||
"xAxis": { |
||||
"type": 'category', |
||||
"axisLabel": { |
||||
"color": '#666666' |
||||
}, |
||||
"axisLine": { |
||||
"lineStyle": { |
||||
"color": '#CCCCCC' |
||||
} |
||||
}, |
||||
"boundaryGap": true, |
||||
"data": [] |
||||
}, |
||||
"yAxis": { |
||||
"type": 'value', |
||||
"axisTick": { |
||||
"show": false, |
||||
}, |
||||
"axisLabel": { |
||||
"color": '#666666' |
||||
}, |
||||
"axisLine": { |
||||
"lineStyle": { |
||||
"color": '#CCCCCC' |
||||
} |
||||
}, |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'line', |
||||
"data": [], |
||||
"barwidth": 20, |
||||
"label": { |
||||
"show": true, |
||||
"color": "#666666", |
||||
"position": 'top', |
||||
}, |
||||
}, |
||||
}, |
||||
"area": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'axis' |
||||
}, |
||||
"grid": { |
||||
"top": 30, |
||||
"bottom": 50, |
||||
"right": 15, |
||||
"left": 40 |
||||
}, |
||||
"legend": { |
||||
"bottom": 'left', |
||||
}, |
||||
"toolbox": { |
||||
"show": false, |
||||
}, |
||||
"xAxis": { |
||||
"type": 'category', |
||||
"axisLabel": { |
||||
"color": '#666666' |
||||
}, |
||||
"axisLine": { |
||||
"lineStyle": { |
||||
"color": '#CCCCCC' |
||||
} |
||||
}, |
||||
"boundaryGap": true, |
||||
"data": [] |
||||
}, |
||||
"yAxis": { |
||||
"type": 'value', |
||||
"axisTick": { |
||||
"show": false, |
||||
}, |
||||
"axisLabel": { |
||||
"color": '#666666' |
||||
}, |
||||
"axisLine": { |
||||
"lineStyle": { |
||||
"color": '#CCCCCC' |
||||
} |
||||
}, |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'line', |
||||
"data": [], |
||||
"areaStyle": {}, |
||||
"label": { |
||||
"show": true, |
||||
"color": "#666666", |
||||
"position": 'top', |
||||
}, |
||||
}, |
||||
}, |
||||
"pie": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'item' |
||||
}, |
||||
"grid": { |
||||
"top": 40, |
||||
"bottom": 30, |
||||
"right": 15, |
||||
"left": 15 |
||||
}, |
||||
"legend": { |
||||
"bottom": 'left', |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'pie', |
||||
"data": [], |
||||
"radius": '50%', |
||||
"label": { |
||||
"show": true, |
||||
"color": "#666666", |
||||
"position": 'top', |
||||
}, |
||||
}, |
||||
}, |
||||
"ring": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'item' |
||||
}, |
||||
"grid": { |
||||
"top": 40, |
||||
"bottom": 30, |
||||
"right": 15, |
||||
"left": 15 |
||||
}, |
||||
"legend": { |
||||
"bottom": 'left', |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'pie', |
||||
"data": [], |
||||
"radius": ['40%', '70%'], |
||||
"avoidLabelOverlap": false, |
||||
"label": { |
||||
"show": true, |
||||
"color": "#666666", |
||||
"position": 'top', |
||||
}, |
||||
"labelLine": { |
||||
"show": true |
||||
}, |
||||
}, |
||||
}, |
||||
"rose": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'item' |
||||
}, |
||||
"legend": { |
||||
"top": 'bottom' |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'pie', |
||||
"data": [], |
||||
"radius": "55%", |
||||
"center": ['50%', '50%'], |
||||
"roseType": 'area', |
||||
}, |
||||
}, |
||||
"funnel": { |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"tooltip": { |
||||
"trigger": 'item', |
||||
"formatter": "{b} : {c}%" |
||||
}, |
||||
"legend": { |
||||
"top": 'bottom' |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'funnel', |
||||
"left": '10%', |
||||
"top": 60, |
||||
"bottom": 60, |
||||
"width": '80%', |
||||
"min": 0, |
||||
"max": 100, |
||||
"minSize": '0%', |
||||
"maxSize": '100%', |
||||
"sort": 'descending', |
||||
"gap": 2, |
||||
"label": { |
||||
"show": true, |
||||
"position": 'inside' |
||||
}, |
||||
"labelLine": { |
||||
"length": 10, |
||||
"lineStyle": { |
||||
"width": 1, |
||||
"type": 'solid' |
||||
} |
||||
}, |
||||
"itemStyle": { |
||||
"bordercolor": '#fff', |
||||
"borderwidth": 1 |
||||
}, |
||||
"emphasis": { |
||||
"label": { |
||||
"fontSize": 20 |
||||
} |
||||
}, |
||||
"data": [], |
||||
}, |
||||
}, |
||||
"gauge": { |
||||
"color": color, |
||||
"tooltip": { |
||||
"formatter": '{a} <br/>{b} : {c}%' |
||||
}, |
||||
"seriesTemplate": { |
||||
"name": '业务指标', |
||||
"type": 'gauge', |
||||
"detail": {"formatter": '{value}%'}, |
||||
"data": [{"value": 50, "name": '完成率'}] |
||||
}, |
||||
}, |
||||
"candle": { |
||||
"xAxis": { |
||||
"data": [] |
||||
}, |
||||
"yAxis": {}, |
||||
"color": color, |
||||
"title": { |
||||
"text": '' |
||||
}, |
||||
"dataZoom": [{ |
||||
"type": 'inside', |
||||
"xAxisIndex": [0, 1], |
||||
"start": 10, |
||||
"end": 100 |
||||
}, |
||||
{ |
||||
"show": true, |
||||
"xAxisIndex": [0, 1], |
||||
"type": 'slider', |
||||
"bottom": 10, |
||||
"start": 10, |
||||
"end": 100 |
||||
} |
||||
], |
||||
"seriesTemplate": { |
||||
"name": '', |
||||
"type": 'k', |
||||
"data": [], |
||||
}, |
||||
} |
||||
} |
||||
|
||||
export default cfe; |
@ -1,601 +0,0 @@
|
||||
/* |
||||
* uCharts® |
||||
* 高性能跨平台图表库,支持H5、APP、小程序(微信/支付宝/百度/头条/QQ/360)、Vue、Taro等支持canvas的框架平台 |
||||
* Copyright (c) 2021 QIUN®秋云 https://www.ucharts.cn All rights reserved.
|
||||
* Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
* 复制使用请保留本段注释,感谢支持开源! |
||||
*
|
||||
* uCharts®官方网站 |
||||
* https://www.uCharts.cn
|
||||
*
|
||||
* 开源地址: |
||||
* https://gitee.com/uCharts/uCharts
|
||||
*
|
||||
* uni-app插件市场地址: |
||||
* http://ext.dcloud.net.cn/plugin?id=271
|
||||
*
|
||||
*/ |
||||
|
||||
// 主题颜色配置:如每个图表类型需要不同主题,请在对应图表类型上更改color属性
|
||||
const color = ['#1890FF', '#91CB74', '#FAC858', '#EE6666', '#73C0DE', '#3CA272', '#FC8452', '#9A60B4', '#ea7ccc']; |
||||
|
||||
//事件转换函数,主要用作格式化x轴为时间轴,根据需求自行修改
|
||||
const formatDateTime = (timeStamp, returnType)=>{ |
||||
var date = new Date(); |
||||
date.setTime(timeStamp * 1000); |
||||
var y = date.getFullYear(); |
||||
var m = date.getMonth() + 1; |
||||
m = m < 10 ? ('0' + m) : m; |
||||
var d = date.getDate(); |
||||
d = d < 10 ? ('0' + d) : d; |
||||
var h = date.getHours(); |
||||
h = h < 10 ? ('0' + h) : h; |
||||
var minute = date.getMinutes(); |
||||
var second = date.getSeconds(); |
||||
minute = minute < 10 ? ('0' + minute) : minute; |
||||
second = second < 10 ? ('0' + second) : second; |
||||
if(returnType == 'full'){return y + '-' + m + '-' + d + ' '+ h +':' + minute + ':' + second;} |
||||
if(returnType == 'y-m-d'){return y + '-' + m + '-' + d;} |
||||
if(returnType == 'h:m'){return h +':' + minute;} |
||||
if(returnType == 'h:m:s'){return h +':' + minute +':' + second;} |
||||
return [y, m, d, h, minute, second]; |
||||
} |
||||
|
||||
const cfu = { |
||||
//demotype为自定义图表类型,一般不需要自定义图表类型,只需要改根节点上对应的类型即可
|
||||
"type":["pie","ring","rose","word","funnel","map","arcbar","line","column","mount","bar","area","radar","gauge","candle","mix","tline","tarea","scatter","bubble","demotype"], |
||||
"range":["饼状图","圆环图","玫瑰图","词云图","漏斗图","地图","圆弧进度条","折线图","柱状图","山峰图","条状图","区域图","雷达图","仪表盘","K线图","混合图","时间轴折线","时间轴区域","散点图","气泡图","自定义类型"], |
||||
//增加自定义图表类型,如果需要categories,请在这里加入您的图表类型,例如最后的"demotype"
|
||||
//自定义类型时需要注意"tline","tarea","scatter","bubble"等时间轴(矢量x轴)类图表,没有categories,不需要加入categories
|
||||
"categories":["line","column","mount","bar","area","radar","gauge","candle","mix","demotype"], |
||||
//instance为实例变量承载属性,不要删除
|
||||
"instance":{}, |
||||
//option为opts及eopts承载属性,不要删除
|
||||
"option":{}, |
||||
//下面是自定义format配置,因除H5端外的其他端无法通过props传递函数,只能通过此属性对应下标的方式来替换
|
||||
"formatter":{ |
||||
"yAxisDemo1":function(val, index, opts){return val+'元'}, |
||||
"yAxisDemo2":function(val, index, opts){return val.toFixed(2)}, |
||||
"xAxisDemo1":function(val, index, opts){return val+'年';}, |
||||
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')}, |
||||
"seriesDemo1":function(val, index, series, opts){return val+'元'}, |
||||
"tooltipDemo1":function(item, category, index, opts){ |
||||
if(index==0){ |
||||
return '随便用'+item.data+'年' |
||||
}else{ |
||||
return '其他我没改'+item.data+'天' |
||||
} |
||||
}, |
||||
"pieDemo":function(val, index, series, opts){ |
||||
if(index !== undefined){ |
||||
return series[index].name+':'+series[index].data+'元' |
||||
} |
||||
}, |
||||
}, |
||||
//这里演示了自定义您的图表类型的option,可以随意命名,之后在组件上 type="demotype" 后,组件会调用这个花括号里的option,如果组件上还存在opts参数,会将demotype与opts中option合并后渲染图表。
|
||||
"demotype":{ |
||||
//我这里把曲线图当做了自定义图表类型,您可以根据需要随意指定类型或配置
|
||||
"type": "line", |
||||
"color": color, |
||||
"padding": [15,10,0,15], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
}, |
||||
"yAxis": { |
||||
"gridType": "dash", |
||||
"dashLength": 2, |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"line": { |
||||
"type": "curve", |
||||
"width": 2 |
||||
}, |
||||
} |
||||
}, |
||||
//下面是自定义配置,请添加项目所需的通用配置
|
||||
"pie":{ |
||||
"type": "pie", |
||||
"color": color, |
||||
"padding": [5,5,5,5], |
||||
"extra": { |
||||
"pie": { |
||||
"activeOpacity": 0.5, |
||||
"activeRadius": 10, |
||||
"offsetAngle": 0, |
||||
"labelWidth": 15, |
||||
"border": true, |
||||
"borderWidth": 3, |
||||
"borderColor": "#FFFFFF" |
||||
}, |
||||
} |
||||
}, |
||||
"ring":{ |
||||
"type": "ring", |
||||
"color": color, |
||||
"padding": [5,5,5,5], |
||||
"rotate": false, |
||||
"dataLabel": true, |
||||
"legend": { |
||||
"show": true, |
||||
"position": "right", |
||||
"lineHeight": 25, |
||||
}, |
||||
"title": { |
||||
"name": "收益率", |
||||
"fontSize": 15, |
||||
"color": "#666666" |
||||
}, |
||||
"subtitle": { |
||||
"name": "70%", |
||||
"fontSize": 25, |
||||
"color": "#7cb5ec" |
||||
}, |
||||
"extra": { |
||||
"ring": { |
||||
"ringWidth":30, |
||||
"activeOpacity": 0.5, |
||||
"activeRadius": 10, |
||||
"offsetAngle": 0, |
||||
"labelWidth": 15, |
||||
"border": true, |
||||
"borderWidth": 3, |
||||
"borderColor": "#FFFFFF" |
||||
}, |
||||
}, |
||||
}, |
||||
"rose":{ |
||||
"type": "rose", |
||||
"color": color, |
||||
"padding": [5,5,5,5], |
||||
"legend": { |
||||
"show": true, |
||||
"position": "left", |
||||
"lineHeight": 25, |
||||
}, |
||||
"extra": { |
||||
"rose": { |
||||
"type": "area", |
||||
"minRadius": 50, |
||||
"activeOpacity": 0.5, |
||||
"activeRadius": 10, |
||||
"offsetAngle": 0, |
||||
"labelWidth": 15, |
||||
"border": false, |
||||
"borderWidth": 2, |
||||
"borderColor": "#FFFFFF" |
||||
}, |
||||
} |
||||
}, |
||||
"word":{ |
||||
"type": "word", |
||||
"color": color, |
||||
"extra": { |
||||
"word": { |
||||
"type": "normal", |
||||
"autoColors": false |
||||
} |
||||
} |
||||
}, |
||||
"funnel":{ |
||||
"type": "funnel", |
||||
"color": color, |
||||
"padding": [15,15,0,15], |
||||
"extra": { |
||||
"funnel": { |
||||
"activeOpacity": 0.3, |
||||
"activeWidth": 10, |
||||
"border": true, |
||||
"borderWidth": 2, |
||||
"borderColor": "#FFFFFF", |
||||
"fillOpacity": 1, |
||||
"labelAlign": "right" |
||||
}, |
||||
} |
||||
}, |
||||
"map":{ |
||||
"type": "map", |
||||
"color": color, |
||||
"padding": [0,0,0,0], |
||||
"dataLabel": true, |
||||
"extra": { |
||||
"map": { |
||||
"border": true, |
||||
"borderWidth": 1, |
||||
"borderColor": "#666666", |
||||
"fillOpacity": 0.6, |
||||
"activeBorderColor": "#F04864", |
||||
"activeFillColor": "#FACC14", |
||||
"activeFillOpacity": 1 |
||||
}, |
||||
} |
||||
}, |
||||
"arcbar":{ |
||||
"type": "arcbar", |
||||
"color": color, |
||||
"title": { |
||||
"name": "百分比", |
||||
"fontSize": 25, |
||||
"color": "#00FF00" |
||||
}, |
||||
"subtitle": { |
||||
"name": "默认标题", |
||||
"fontSize": 15, |
||||
"color": "#666666" |
||||
}, |
||||
"extra": { |
||||
"arcbar": { |
||||
"type": "default", |
||||
"width": 12, |
||||
"backgroundColor": "#E9E9E9", |
||||
"startAngle": 0.75, |
||||
"endAngle": 0.25, |
||||
"gap": 2 |
||||
} |
||||
} |
||||
}, |
||||
"line":{ |
||||
"type": "line", |
||||
"color": color, |
||||
"padding": [15,10,0,15], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
}, |
||||
"yAxis": { |
||||
"gridType": "dash", |
||||
"dashLength": 2, |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"line": { |
||||
"type": "straight", |
||||
"width": 2 |
||||
}, |
||||
} |
||||
}, |
||||
"tline":{ |
||||
"type": "line", |
||||
"color": color, |
||||
"padding": [15,10,0,15], |
||||
"xAxis": { |
||||
"disableGrid": false, |
||||
"boundaryGap":"justify", |
||||
}, |
||||
"yAxis": { |
||||
"gridType": "dash", |
||||
"dashLength": 2, |
||||
"data":[ |
||||
{ |
||||
"min":0, |
||||
"max":80 |
||||
} |
||||
] |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"line": { |
||||
"type": "curve", |
||||
"width": 2 |
||||
}, |
||||
} |
||||
}, |
||||
"tarea":{ |
||||
"type": "area", |
||||
"color": color, |
||||
"padding": [15,10,0,15], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
"boundaryGap":"justify", |
||||
}, |
||||
"yAxis": { |
||||
"gridType": "dash", |
||||
"dashLength": 2, |
||||
"data":[ |
||||
{ |
||||
"min":0, |
||||
"max":80 |
||||
} |
||||
] |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"area": { |
||||
"type": "curve", |
||||
"opacity": 0.2, |
||||
"addLine": true, |
||||
"width": 2, |
||||
"gradient": true |
||||
}, |
||||
} |
||||
}, |
||||
"column":{ |
||||
"type": "column", |
||||
"color": color, |
||||
"padding": [15,15,0,5], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
}, |
||||
"yAxis": { |
||||
"data":[{"min":0}] |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"column": { |
||||
"type": "group", |
||||
"width": 30, |
||||
"activeBgColor": "#000000", |
||||
"activeBgOpacity": 0.08 |
||||
}, |
||||
} |
||||
}, |
||||
"mount":{ |
||||
"type": "mount", |
||||
"color": color, |
||||
"padding": [15,15,0,5], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
}, |
||||
"yAxis": { |
||||
"data":[{"min":0}] |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"mount": { |
||||
"type": "mount", |
||||
"widthRatio": 1.5, |
||||
}, |
||||
} |
||||
}, |
||||
"bar":{ |
||||
"type": "bar", |
||||
"color": color, |
||||
"padding": [15,30,0,5], |
||||
"xAxis": { |
||||
"boundaryGap":"justify", |
||||
"disableGrid":false, |
||||
"min":0, |
||||
"axisLine":false |
||||
}, |
||||
"yAxis": { |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"bar": { |
||||
"type": "group", |
||||
"width": 30, |
||||
"meterBorde": 1, |
||||
"meterFillColor": "#FFFFFF", |
||||
"activeBgColor": "#000000", |
||||
"activeBgOpacity": 0.08 |
||||
}, |
||||
} |
||||
}, |
||||
"area":{ |
||||
"type": "area", |
||||
"color": color, |
||||
"padding": [15,15,0,15], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
}, |
||||
"yAxis": { |
||||
"gridType": "dash", |
||||
"dashLength": 2, |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"area": { |
||||
"type": "straight", |
||||
"opacity": 0.2, |
||||
"addLine": true, |
||||
"width": 2, |
||||
"gradient": false |
||||
}, |
||||
} |
||||
}, |
||||
"radar":{ |
||||
"type": "radar", |
||||
"color": color, |
||||
"padding": [5,5,5,5], |
||||
"dataLabel": false, |
||||
"legend": { |
||||
"show": true, |
||||
"position": "right", |
||||
"lineHeight": 25, |
||||
}, |
||||
"extra": { |
||||
"radar": { |
||||
"gridType": "radar", |
||||
"gridColor": "#CCCCCC", |
||||
"gridCount": 3, |
||||
"opacity": 0.2, |
||||
"max": 200 |
||||
}, |
||||
} |
||||
}, |
||||
"gauge":{ |
||||
"type": "gauge", |
||||
"color": color, |
||||
"title": { |
||||
"name": "66Km/H", |
||||
"fontSize": 25, |
||||
"color": "#2fc25b", |
||||
"offsetY": 50 |
||||
}, |
||||
"subtitle": { |
||||
"name": "实时速度", |
||||
"fontSize": 15, |
||||
"color": "#1890ff", |
||||
"offsetY": -50 |
||||
}, |
||||
"extra": { |
||||
"gauge": { |
||||
"type": "default", |
||||
"width": 30, |
||||
"labelColor": "#666666", |
||||
"startAngle": 0.75, |
||||
"endAngle": 0.25, |
||||
"startNumber": 0, |
||||
"endNumber": 100, |
||||
"labelFormat": "", |
||||
"splitLine": { |
||||
"fixRadius": 0, |
||||
"splitNumber": 10, |
||||
"width": 30, |
||||
"color": "#FFFFFF", |
||||
"childNumber": 5, |
||||
"childWidth": 12 |
||||
}, |
||||
"pointer": { |
||||
"width": 24, |
||||
"color": "auto" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
"candle":{ |
||||
"type": "candle", |
||||
"color": color, |
||||
"padding": [15,15,0,15], |
||||
"enableScroll": true, |
||||
"enableMarkLine": true, |
||||
"dataLabel": false, |
||||
"xAxis": { |
||||
"labelCount": 4, |
||||
"itemCount": 40, |
||||
"disableGrid": true, |
||||
"gridColor": "#CCCCCC", |
||||
"gridType": "solid", |
||||
"dashLength": 4, |
||||
"scrollShow": true, |
||||
"scrollAlign": "left", |
||||
"scrollColor": "#A6A6A6", |
||||
"scrollBackgroundColor": "#EFEBEF" |
||||
}, |
||||
"yAxis": { |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"candle": { |
||||
"color": { |
||||
"upLine": "#f04864", |
||||
"upFill": "#f04864", |
||||
"downLine": "#2fc25b", |
||||
"downFill": "#2fc25b" |
||||
}, |
||||
"average": { |
||||
"show": true, |
||||
"name": ["MA5","MA10","MA30"], |
||||
"day": [5,10,20], |
||||
"color": ["#1890ff","#2fc25b","#facc14"] |
||||
} |
||||
}, |
||||
"markLine": { |
||||
"type": "dash", |
||||
"dashLength": 5, |
||||
"data": [ |
||||
{ |
||||
"value": 2150, |
||||
"lineColor": "#f04864", |
||||
"showLabel": true |
||||
}, |
||||
{ |
||||
"value": 2350, |
||||
"lineColor": "#f04864", |
||||
"showLabel": true |
||||
} |
||||
] |
||||
} |
||||
} |
||||
}, |
||||
"mix":{ |
||||
"type": "mix", |
||||
"color": color, |
||||
"padding": [15,15,0,15], |
||||
"xAxis": { |
||||
"disableGrid": true, |
||||
}, |
||||
"yAxis": { |
||||
"disabled": false, |
||||
"disableGrid": false, |
||||
"splitNumber": 5, |
||||
"gridType": "dash", |
||||
"dashLength": 4, |
||||
"gridColor": "#CCCCCC", |
||||
"padding": 10, |
||||
"showTitle": true, |
||||
"data": [] |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"mix": { |
||||
"column": { |
||||
"width": 20 |
||||
} |
||||
}, |
||||
} |
||||
}, |
||||
"scatter":{ |
||||
"type": "scatter", |
||||
"color":color, |
||||
"padding":[15,15,0,15], |
||||
"dataLabel":false, |
||||
"xAxis": { |
||||
"disableGrid": false, |
||||
"gridType":"dash", |
||||
"splitNumber":5, |
||||
"boundaryGap":"justify", |
||||
"min":0 |
||||
}, |
||||
"yAxis": { |
||||
"disableGrid": false, |
||||
"gridType":"dash", |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"scatter": { |
||||
}, |
||||
} |
||||
}, |
||||
"bubble":{ |
||||
"type": "bubble", |
||||
"color":color, |
||||
"padding":[15,15,0,15], |
||||
"xAxis": { |
||||
"disableGrid": false, |
||||
"gridType":"dash", |
||||
"splitNumber":5, |
||||
"boundaryGap":"justify", |
||||
"min":0, |
||||
"max":250 |
||||
}, |
||||
"yAxis": { |
||||
"disableGrid": false, |
||||
"gridType":"dash", |
||||
"data":[{ |
||||
"min":0, |
||||
"max":150 |
||||
}] |
||||
}, |
||||
"legend": { |
||||
}, |
||||
"extra": { |
||||
"bubble": { |
||||
"border":2, |
||||
"opacity": 0.5, |
||||
}, |
||||
} |
||||
} |
||||
} |
||||
|
||||
export default cfu; |
@ -1,5 +0,0 @@
|
||||
# uCharts JSSDK说明 |
||||
1、如不使用uCharts组件,可直接引用u-charts.js,打包编译后会`自动压缩`,压缩后体积约为`120kb`。 |
||||
2、如果120kb的体积仍需压缩,请手到uCharts官网通过在线定制选择您需要的图表。 |
||||
3、config-ucharts.js为uCharts组件的用户配置文件,升级前请`自行备份config-ucharts.js`文件,以免被强制覆盖。 |
||||
4、config-echarts.js为ECharts组件的用户配置文件,升级前请`自行备份config-echarts.js`文件,以免被强制覆盖。 |
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,201 +0,0 @@
|
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
http://www.apache.org/licenses/ |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, |
||||
and distribution as defined by Sections 1 through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by |
||||
the copyright owner that is granting the License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all |
||||
other entities that control, are controlled by, or are under common |
||||
control with that entity. For the purposes of this definition, |
||||
"control" means (i) the power, direct or indirect, to cause the |
||||
direction or management of such entity, whether by contract or |
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
||||
outstanding shares, or (iii) beneficial ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity |
||||
exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, |
||||
including but not limited to software source code, documentation |
||||
source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical |
||||
transformation or translation of a Source form, including but |
||||
not limited to compiled object code, generated documentation, |
||||
and conversions to other media types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or |
||||
Object form, made available under the License, as indicated by a |
||||
copyright notice that is included in or attached to the work |
||||
(an example is provided in the Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object |
||||
form, that is based on (or derived from) the Work and for which the |
||||
editorial revisions, annotations, elaborations, or other modifications |
||||
represent, as a whole, an original work of authorship. For the purposes |
||||
of this License, Derivative Works shall not include works that remain |
||||
separable from, or merely link (or bind by name) to the interfaces of, |
||||
the Work and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including |
||||
the original version of the Work and any modifications or additions |
||||
to that Work or Derivative Works thereof, that is intentionally |
||||
submitted to Licensor for inclusion in the Work by the copyright owner |
||||
or by an individual or Legal Entity authorized to submit on behalf of |
||||
the copyright owner. For the purposes of this definition, "submitted" |
||||
means any form of electronic, verbal, or written communication sent |
||||
to the Licensor or its representatives, including but not limited to |
||||
communication on electronic mailing lists, source code control systems, |
||||
and issue tracking systems that are managed by, or on behalf of, the |
||||
Licensor for the purpose of discussing and improving the Work, but |
||||
excluding communication that is conspicuously marked or otherwise |
||||
designated in writing by the copyright owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity |
||||
on behalf of whom a Contribution has been received by Licensor and |
||||
subsequently incorporated within the Work. |
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
copyright license to reproduce, prepare Derivative Works of, |
||||
publicly display, publicly perform, sublicense, and distribute the |
||||
Work and such Derivative Works in Source or Object form. |
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of |
||||
this License, each Contributor hereby grants to You a perpetual, |
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
||||
(except as stated in this section) patent license to make, have made, |
||||
use, offer to sell, sell, import, and otherwise transfer the Work, |
||||
where such license applies only to those patent claims licensable |
||||
by such Contributor that are necessarily infringed by their |
||||
Contribution(s) alone or by combination of their Contribution(s) |
||||
with the Work to which such Contribution(s) was submitted. If You |
||||
institute patent litigation against any entity (including a |
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
||||
or a Contribution incorporated within the Work constitutes direct |
||||
or contributory patent infringement, then any patent licenses |
||||
granted to You under this License for that Work shall terminate |
||||
as of the date such litigation is filed. |
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the |
||||
Work or Derivative Works thereof in any medium, with or without |
||||
modifications, and in Source or Object form, provided that You |
||||
meet the following conditions: |
||||
|
||||
(a) You must give any other recipients of the Work or |
||||
Derivative Works a copy of this License; and |
||||
|
||||
(b) You must cause any modified files to carry prominent notices |
||||
stating that You changed the files; and |
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works |
||||
that You distribute, all copyright, patent, trademark, and |
||||
attribution notices from the Source form of the Work, |
||||
excluding those notices that do not pertain to any part of |
||||
the Derivative Works; and |
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its |
||||
distribution, then any Derivative Works that You distribute must |
||||
include a readable copy of the attribution notices contained |
||||
within such NOTICE file, excluding those notices that do not |
||||
pertain to any part of the Derivative Works, in at least one |
||||
of the following places: within a NOTICE text file distributed |
||||
as part of the Derivative Works; within the Source form or |
||||
documentation, if provided along with the Derivative Works; or, |
||||
within a display generated by the Derivative Works, if and |
||||
wherever such third-party notices normally appear. The contents |
||||
of the NOTICE file are for informational purposes only and |
||||
do not modify the License. You may add Your own attribution |
||||
notices within Derivative Works that You distribute, alongside |
||||
or as an addendum to the NOTICE text from the Work, provided |
||||
that such additional attribution notices cannot be construed |
||||
as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and |
||||
may provide additional or different license terms and conditions |
||||
for use, reproduction, or distribution of Your modifications, or |
||||
for any such Derivative Works as a whole, provided Your use, |
||||
reproduction, and distribution of the Work otherwise complies with |
||||
the conditions stated in this License. |
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, |
||||
any Contribution intentionally submitted for inclusion in the Work |
||||
by You to the Licensor shall be under the terms and conditions of |
||||
this License, without any additional terms or conditions. |
||||
Notwithstanding the above, nothing herein shall supersede or modify |
||||
the terms of any separate license agreement you may have executed |
||||
with Licensor regarding such Contributions. |
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade |
||||
names, trademarks, service marks, or product names of the Licensor, |
||||
except as required for reasonable and customary use in describing the |
||||
origin of the Work and reproducing the content of the NOTICE file. |
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or |
||||
agreed to in writing, Licensor provides the Work (and each |
||||
Contributor provides its Contributions) on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
||||
implied, including, without limitation, any warranties or conditions |
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
||||
PARTICULAR PURPOSE. You are solely responsible for determining the |
||||
appropriateness of using or redistributing the Work and assume any |
||||
risks associated with Your exercise of permissions under this License. |
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, |
||||
whether in tort (including negligence), contract, or otherwise, |
||||
unless required by applicable law (such as deliberate and grossly |
||||
negligent acts) or agreed to in writing, shall any Contributor be |
||||
liable to You for damages, including any direct, indirect, special, |
||||
incidental, or consequential damages of any character arising as a |
||||
result of this License or out of the use or inability to use the |
||||
Work (including but not limited to damages for loss of goodwill, |
||||
work stoppage, computer failure or malfunction, or any and all |
||||
other commercial damages or losses), even if such Contributor |
||||
has been advised of the possibility of such damages. |
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing |
||||
the Work or Derivative Works thereof, You may choose to offer, |
||||
and charge a fee for, acceptance of support, warranty, indemnity, |
||||
or other liability obligations and/or rights consistent with this |
||||
License. However, in accepting such obligations, You may act only |
||||
on Your own behalf and on Your sole responsibility, not on behalf |
||||
of any other Contributor, and only if You agree to indemnify, |
||||
defend, and hold each Contributor harmless for any liability |
||||
incurred by, or claims asserted against, such Contributor by reason |
||||
of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
|
||||
APPENDIX: How to apply the Apache License to your work. |
||||
|
||||
To apply the Apache License to your work, attach the following |
||||
boilerplate notice, with the fields enclosed by brackets "[]" |
||||
replaced with your own identifying information. (Don't include |
||||
the brackets!) The text should be enclosed in the appropriate |
||||
comment syntax for the file format. We also recommend that a |
||||
file or class name and description of purpose be included on the |
||||
same "printed page" as the copyright notice for easier |
||||
identification within third-party archives. |
||||
|
||||
Copyright [yyyy] [name of copyright owner] |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
you may not use this file except in compliance with the License. |
||||
You may obtain a copy of the License at |
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
@ -1,84 +0,0 @@
|
||||
{ |
||||
"id": "qiun-data-charts", |
||||
"displayName": "秋云 ucharts echarts 高性能跨全端图表组件", |
||||
"version": "2.4.3-20220505", |
||||
"description": "uCharts 新增双指缩放、新增山峰图!支持H5及APP用 ucharts echarts 渲染图表,uniapp可视化首选组件", |
||||
"keywords": [ |
||||
"ucharts", |
||||
"echarts", |
||||
"f2", |
||||
"图表", |
||||
"可视化" |
||||
], |
||||
"repository": "https://gitee.com/uCharts/uCharts", |
||||
"engines": { |
||||
"HBuilderX": "^3.3.8" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"前端组件", |
||||
"通用组件" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "474119" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "插件不采集任何数据", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "https://www.npmjs.com/~qiun" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": [], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "y" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y" |
||||
}, |
||||
"快应用": { |
||||
"华为": "y", |
||||
"联盟": "y" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,102 +0,0 @@
|
||||
|
||||
|
||||
## <font color='red'>写给uCharts使用者的一封信</font> |
||||
<font color='red'> |
||||
亲爱的用户: |
||||
|
||||
- 由于最近上线的官网中实行了部分收费体验,收到了许多用户的使用反馈,大致反馈的问题都指向同一矛头:为何新官网的在线工具也要收费?对于这件事,我们深表歉意。由于新官网本身未提供技术文档,使得用户误以为我们对文档实行了收费。经我们连夜整改,新官网目前已经将技术文档开放出来供大家阅读使用,并免费对外开放了【演示】中的查看全端全平台的代码的功能,为此再次向所受影响的用户们致以诚恳的歉意。 |
||||
|
||||
- 其次,我们须澄清几点,如下: |
||||
1. uCharts的插件本身遵循开源原则,并不收费,用户可自行到DCloud市场与Gitee码云上获取源码 |
||||
2. uCharts的技术文档永久对用户开放 |
||||
3. 收费内容仅针对原生工具、组件工具、定制功能以及模板市场的部分收费模板 |
||||
|
||||
- uCharts为什么实行收费原则? |
||||
1. 服务器的费用支撑 |
||||
2. 团队的运营支出;正如你所见,我们的群里有大量的用户在请教图表配置与反馈问题,群里的每一位管理员都在花费不少精力在积极解决用户的问题,然而遇到巨大的咨询量时,我们无法及时、精准解答回复,因此,我们推出了会员优先服务 |
||||
3. 与其说模板市场是收费,倒不如说给野生用户提供了创造价值的机会,用户既可以在上面发布模板赚取费用,遇到心动的模板也能免费/付费使用 |
||||
|
||||
- 收费不是目的,正如你们所见,用户可以申请成为[【开发者】](https://www.ucharts.cn/v2/#/agreement/developer),开发者不限制任何官网功能,并享有官方指导、开发、改造uCharts的权力,并且活动期间【返还超级会员费用】!我们想说的是,我们新版官网上线旨在希望更多的用户加入到开发者的队伍,我们共同去维护uCharts! |
||||
|
||||
我们相信:星星之火可以燎原! |
||||
|
||||
uCharts技术团队 |
||||
|
||||
2022.4.23 |
||||
|
||||
</font> |
||||
|
||||
|
||||
![logo](https://img-blog.csdnimg.cn/4a276226973841468c1be356f8d9438b.png) |
||||
|
||||
|
||||
[![star](https://gitee.com/uCharts/uCharts/badge/star.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/stargazers) |
||||
[![fork](https://gitee.com/uCharts/uCharts/badge/fork.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/members) |
||||
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) |
||||
[![npm package](https://img.shields.io/npm/v/@qiun/ucharts.svg?style=flat-square)](https://www.npmjs.com/~qiun) |
||||
|
||||
|
||||
## uCharts简介 |
||||
|
||||
`uCharts`是一款基于`canvas API`开发的适用于所有前端应用的图表库,开发者编写一套代码,可运行到 Web、iOS、Android(基于 uni-app / taro )、以及各种小程序(微信/支付宝/百度/头条/飞书/QQ/快手/钉钉/淘宝)、快应用等更多支持 canvas API 的平台。 |
||||
|
||||
## 官方网站 |
||||
|
||||
## [https://www.ucharts.cn](https://www.ucharts.cn) |
||||
|
||||
## 快速体验 |
||||
|
||||
一套代码编到多个平台,依次扫描二维码,亲自体验uCharts图表跨平台效果!其他平台请自行编译。 |
||||
|
||||
![](https://www.ucharts.cn/images/web/guide/qrcode20220224.png) |
||||
|
||||
## 致开发者 |
||||
|
||||
感谢各位开发者`四年`来对秋云及uCharts的支持,uCharts的进步离不开各位开发者的鼓励与贡献。为更好的帮助各位开发者使用图表工具,我们推出了新版官网,增加了在线定制、问答社区、在线配置等一些增值服务,为确保您能更好的应用图表组件,建议您先`仔细阅读本页指南`以及`常见问题`,而不是下载下来`直接使用`。如仍然不能解决,请到`官网社区`或开通会员后加入`专属VIP会员群`提问将会很快得到回答。 |
||||
|
||||
## 社群支持 |
||||
|
||||
uCharts官方拥有4个2000人的QQ群及专属VIP会员群支持,庞大的用户量证明我们一直在努力,请各位放心使用!uCharts的开源图表组件的开发,团队付出了大量的时间与精力,经过四来的考验,不会有比较明显的bug,请各位放心使用。如果您有更好的想法,可以在`码云提交Pull Requests`以帮助更多开发者完成需求,再次感谢各位对uCharts的鼓励与支持! |
||||
|
||||
#### 官方交流群 |
||||
- 交流群1:371774600(已满) |
||||
- 交流群2:619841586(已满) |
||||
- 交流群3:955340127(已满) |
||||
- 交流群4:641669795 |
||||
- 口令`uniapp` |
||||
|
||||
#### 专属VIP会员群 |
||||
- 开通会员后详见【账号详情】页面中顶部的滚动通知 |
||||
- 口令`您的用户ID` |
||||
|
||||
## 版权信息 |
||||
|
||||
uCharts始终坚持开源,遵循 [Apache Licence 2.0](https://www.apache.org/licenses/LICENSE-2.0.html) 开源协议,意味着您无需支付任何费用,即可将uCharts应用到您的产品中。 |
||||
|
||||
注意:这并不意味着您可以将uCharts应用到非法的领域,比如涉及赌博,暴力等方面。如因此产生纠纷或法律问题,uCharts相关方及秋云科技不承担任何责任。 |
||||
|
||||
## 合作伙伴 |
||||
|
||||
[![DIY官网](https://www.ucharts.cn/images/web/guide/links/diy-gw.png)](https://www.diygw.com/) |
||||
[![HasChat](https://www.ucharts.cn/images/web/guide/links/haschat.png)](https://gitee.com/howcode/has-chat) |
||||
[![uViewUI](https://www.ucharts.cn/images/web/guide/links/uView.png)](https://www.uviewui.com/) |
||||
[![图鸟UI](https://www.ucharts.cn/images/web/guide/links/tuniao.png)](https://ext.dcloud.net.cn/plugin?id=7088) |
||||
[![thorui](https://www.ucharts.cn/images/web/guide/links/thorui.png)](https://ext.dcloud.net.cn/publisher?id=202) |
||||
[![FirstUI](https://www.ucharts.cn/images/web/guide/links/first.png)](https://www.firstui.cn/) |
||||
[![nProUI](https://www.ucharts.cn/images/web/guide/links/nPro.png)](https://ext.dcloud.net.cn/plugin?id=5169) |
||||
[![GraceUI](https://www.ucharts.cn/images/web/guide/links/grace.png)](https://www.graceui.com/) |
||||
|
||||
|
||||
## 更新记录 |
||||
|
||||
详见官网指南中说明,[点击此处查看](https://www.ucharts.cn/v2/#/guide/index?id=100) |
||||
|
||||
|
||||
## 相关链接 |
||||
- [uCharts官网](https://www.ucharts.cn) |
||||
- [DCloud插件市场地址](https://ext.dcloud.net.cn/plugin?id=271) |
||||
- [uCharts码云开源托管地址](https://gitee.com/uCharts/uCharts) [![star](https://gitee.com/uCharts/uCharts/badge/star.svg?theme=gvp)](https://gitee.com/uCharts/uCharts/stargazers) |
||||
- [uCharts npm开源地址](https://www.ucharts.cn) |
||||
- [ECharts官网](https://echarts.apache.org/zh/index.html) |
||||
- [ECharts配置手册](https://echarts.apache.org/zh/option.html) |
||||
- [图表组件在项目中的应用 ReportPlus数据报表](https://www.ucharts.cn/v2/#/layout/info?id=1) |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,20 +0,0 @@
|
||||
## 1.0.9(2022-07-28) |
||||
- 完善是否创建新条目功能,并将默认值改为允许 |
||||
## 1.0.8(2022-07-26) |
||||
- 新增禁用选项和是否创建新条目功能,新增disabledColor和isAllowCreate属性 |
||||
## 1.0.7(2022-05-05) |
||||
- 解决传入JSON数组后,在模糊匹配项中进行选择,@select事件返回值为undefined且报错的问题 |
||||
## 1.0.6(2022-03-24) |
||||
- 新增@select事件 |
||||
## 1.0.5(2022-03-22) |
||||
- 修改文档 |
||||
## 1.0.4(2022-03-18) |
||||
- 新增isJSON和keyName属性,candidates支持JSON数组格式 |
||||
## 1.0.3(2022-03-01) |
||||
- 调整为uni_modules目录规范 |
||||
## 1.0.2(2022-03-01) |
||||
- 基于官方uni-combox组件,解决选择后再次选择不展示全部选项的问题,同时新增选中项默认的文字和背景颜色,也可自定义进行样式覆盖 |
||||
## 1.0.1(2022-03-01) |
||||
- 无 |
||||
## 1.0.0(2022-03-01) |
||||
- 无 |
@ -1,402 +0,0 @@
|
||||
<template> |
||||
<view class="superwei-combox" :class="border ? '' : 'superwei-combox__no-border'"> |
||||
<view v-if="label" class="superwei-combox__label" :style="labelStyle"> |
||||
<text>{{label}}</text> |
||||
</view> |
||||
<view class="superwei-combox__input-box"> |
||||
<input class="superwei-combox__input" type="text" :placeholder="placeholder" |
||||
placeholder-class="superwei-combox__input-plac" v-model="inputVal" @input="onInput" @focus="onFocus" |
||||
@blur="onBlur" /> |
||||
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector"> |
||||
</uni-icons> |
||||
</view> |
||||
<view class="superwei-combox__selector" v-if="showSelector"> |
||||
<view class="uni-popper__arrow"></view> |
||||
<scroll-view scroll-y="true" class="superwei-combox__selector-scroll"> |
||||
<view class="superwei-combox__selector-empty" v-if="filterCandidatesLength === 0"> |
||||
<text>{{emptyTips}}</text> |
||||
</view> |
||||
<view class="superwei-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index"> |
||||
<template v-if="(isJSON?(item.disabled?true:false):false)"> |
||||
<text |
||||
:style="'color:'+disabledColor+';cursor: not-allowed;'">{{isJSON?item[keyName]?item[keyName]:'字段'+keyName+'不存在':item}}</text> |
||||
</template> |
||||
<template v-else> |
||||
<text @click="onSelectorClick(index)" |
||||
:style="(isJSON?item[keyName]?item[keyName]==inputVal:false:item==inputVal)?'font-weight: bold;background-color: '+selectedBackground+';color: '+selectedColor:''">{{isJSON?item[keyName]?item[keyName]:'字段'+keyName+'不存在':item}}</text> |
||||
</template> |
||||
</view> |
||||
</scroll-view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* Combox 组合输入框 |
||||
* @description 组合输入框一般用于既可以输入也可以选择的场景 |
||||
* @property {String} label 左侧文字 |
||||
* @property {String} labelWidth 左侧内容宽度 |
||||
* @property {String} placeholder 输入框占位符 |
||||
* @property {Array} candidates 候选项列表 |
||||
* @property {String} emptyTips 筛选结果为空时显示的文字 |
||||
* @property {String} value 组合框的值 |
||||
* @property {String} selectedBackground 选中项背景颜色 |
||||
* @property {String} selectedColor 选中项文字颜色 |
||||
* @property {Boolean} isJSON 是否是json数组 |
||||
* @property {String} keyName json数组显示的字段值 |
||||
* @property {String} disabledColor 禁用项文字颜色 |
||||
* @property {Boolean} isAllowCreate 是否允许用户创建新条目 |
||||
*/ |
||||
export default { |
||||
name: 'superweiCombox', |
||||
emits: ['input', 'update:modelValue', 'select'], |
||||
props: { |
||||
isAllowCreate: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
disabledColor: { |
||||
type: String, |
||||
default: '#ababac' |
||||
}, |
||||
isJSON: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
keyName: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
selectedBackground: { |
||||
type: String, |
||||
default: '#f5f7fa' |
||||
}, |
||||
selectedColor: { |
||||
type: String, |
||||
default: '#409eff' |
||||
}, |
||||
border: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
label: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
labelWidth: { |
||||
type: String, |
||||
default: 'auto' |
||||
}, |
||||
placeholder: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
candidates: { |
||||
type: Array, |
||||
default () { |
||||
return [] |
||||
} |
||||
}, |
||||
emptyTips: { |
||||
type: String, |
||||
default: '无匹配项' |
||||
}, |
||||
// #ifndef VUE3 |
||||
value: { |
||||
type: [String, Number], |
||||
default: '' |
||||
}, |
||||
// #endif |
||||
// #ifdef VUE3 |
||||
modelValue: { |
||||
type: [String, Number], |
||||
default: '' |
||||
}, |
||||
// #endif |
||||
}, |
||||
data() { |
||||
return { |
||||
isInput: false, |
||||
showSelector: false, |
||||
isSelector: false, |
||||
inputVal: '' |
||||
} |
||||
}, |
||||
computed: { |
||||
labelStyle() { |
||||
if (this.labelWidth === 'auto') { |
||||
return "" |
||||
} |
||||
return `width: ${this.labelWidth}` |
||||
}, |
||||
filterCandidates() { |
||||
if (this.isInput) { |
||||
if (this.isJSON) { |
||||
return this.candidates.filter((item) => { |
||||
return item[this.keyName].toString().indexOf(this.inputVal) > -1 |
||||
}) |
||||
} else { |
||||
return this.candidates.filter((item) => { |
||||
return item.toString().indexOf(this.inputVal) > -1 |
||||
}) |
||||
} |
||||
} else { |
||||
return this.candidates |
||||
} |
||||
}, |
||||
filterCandidatesLength() { |
||||
return this.filterCandidates.length |
||||
} |
||||
}, |
||||
watch: { |
||||
// #ifndef VUE3 |
||||
value: { |
||||
handler(newVal) { |
||||
this.inputVal = newVal |
||||
this.isInput = true |
||||
}, |
||||
immediate: true |
||||
}, |
||||
// #endif |
||||
// #ifdef VUE3 |
||||
modelValue: { |
||||
handler(newVal) { |
||||
this.inputVal = newVal |
||||
this.isInput = true |
||||
}, |
||||
immediate: true |
||||
}, |
||||
// #endif |
||||
}, |
||||
methods: { |
||||
toggleSelector() { |
||||
this.showSelector = !this.showSelector |
||||
this.isInput = false |
||||
}, |
||||
onFocus() { |
||||
this.showSelector = true |
||||
this.isInput = false |
||||
}, |
||||
onChange() { |
||||
setTimeout(() => { |
||||
// this.showSelector = false |
||||
this.isInput = false |
||||
}, 200) |
||||
}, |
||||
onBlur() { |
||||
if (!this.isInput) { |
||||
this.onChange() |
||||
} else { |
||||
if (this.inputVal && !this.isAllowCreate) { |
||||
let index = this.candidates.findIndex((item) => { |
||||
if (this.isJSON) { |
||||
return item[this.keyName].toString() == this.inputVal && !item.disabled |
||||
} else { |
||||
return item.toString() == this.inputVal |
||||
} |
||||
}) |
||||
if (index == -1) { |
||||
if (this.filterCandidatesLength > 0) { |
||||
setTimeout(() => { |
||||
this.showSelector = false |
||||
this.isInput = false |
||||
if (!this.isSelector) { |
||||
this.inputVal = '' |
||||
this.$emit('input', this.inputVal) |
||||
this.$emit('update:modelValue', this.inputVal) |
||||
} |
||||
}, 200) |
||||
this.isSelector = false |
||||
} else { |
||||
this.showSelector = false |
||||
this.isInput = false |
||||
this.inputVal = '' |
||||
this.$emit('input', this.inputVal) |
||||
this.$emit('update:modelValue', this.inputVal) |
||||
} |
||||
} else { |
||||
this.onChange() |
||||
} |
||||
} else { |
||||
this.onChange() |
||||
} |
||||
} |
||||
}, |
||||
onSelectorClick(index) { |
||||
let item = this.filterCandidates[index] |
||||
if (this.isJSON) { |
||||
this.inputVal = item[this.keyName] |
||||
} else { |
||||
this.inputVal = item |
||||
} |
||||
this.showSelector = false |
||||
this.isSelector = true |
||||
this.$emit('input', this.inputVal) |
||||
this.$emit('update:modelValue', this.inputVal) |
||||
this.$emit('select', item) |
||||
}, |
||||
onInput() { |
||||
setTimeout(() => { |
||||
this.$emit('input', this.inputVal) |
||||
this.$emit('update:modelValue', this.inputVal) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@media only screen and (max-width: 999px) { |
||||
|
||||
/* 针对手机: */ |
||||
.superwei-combox { |
||||
font-size: 14px; |
||||
border: 0px solid #12b7f5; |
||||
border-radius: 4px; |
||||
padding: 6px 10px; |
||||
position: relative; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
// height: 40px; |
||||
flex-direction: row; |
||||
align-items: center; |
||||
// border-bottom: solid 1px #DDDDDD; |
||||
} |
||||
} |
||||
|
||||
@media only screen and (min-width: 1000px) { |
||||
|
||||
/* 针对手机: */ |
||||
.superwei-combox { |
||||
font-size: 14px; |
||||
border: 2px solid #12b7f5; |
||||
border-radius: 4px; |
||||
padding: 6px 10px; |
||||
position: relative; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
// height: 40px; |
||||
flex-direction: row; |
||||
align-items: center; |
||||
// border-bottom: solid 1px #DDDDDD; |
||||
} |
||||
} |
||||
|
||||
.superwei-combox__label { |
||||
font-size: 16px; |
||||
line-height: 22px; |
||||
padding-right: 10px; |
||||
color: #999999; |
||||
} |
||||
|
||||
.superwei-combox__input-box { |
||||
position: relative; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex: 1; |
||||
flex-direction: row; |
||||
align-items: center; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.superwei-combox__input { |
||||
flex: 1; |
||||
font-size: 14px; |
||||
height: 22px; |
||||
line-height: 22px; |
||||
} |
||||
|
||||
.superwei-combox__input-plac { |
||||
font-size: 14px; |
||||
color: #ccc; //placeholder-style="color:#FFFFFF" |
||||
} |
||||
|
||||
.superwei-combox__selector { |
||||
/* #ifndef APP-NVUE */ |
||||
box-sizing: border-box; |
||||
/* #endif */ |
||||
position: absolute; |
||||
top: calc(100% + 12px); |
||||
left: 0; |
||||
width: 100%; |
||||
background-color: #FFFFFF; |
||||
border: 1px solid #EBEEF5; |
||||
border-radius: 6px; |
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
||||
z-index: 2; |
||||
padding: 4px 0; |
||||
} |
||||
|
||||
.superwei-combox__selector-scroll { |
||||
/* #ifndef APP-NVUE */ |
||||
max-height: 200px; |
||||
box-sizing: border-box; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.superwei-combox__selector-empty, |
||||
.superwei-combox__selector-item { |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
cursor: pointer; |
||||
/* #endif */ |
||||
line-height: 36px; |
||||
font-size: 14px; |
||||
text-align: center; |
||||
// border-bottom: solid 1px #DDDDDD; |
||||
padding: 0px 0px; |
||||
} |
||||
|
||||
.superwei-combox__selector-empty text, |
||||
.superwei-combox__selector-item text { |
||||
width: 100%; |
||||
} |
||||
|
||||
.superwei-combox__selector-item:hover { |
||||
background-color: #f9f9f9; |
||||
} |
||||
|
||||
.superwei-combox__selector-empty:last-child, |
||||
.superwei-combox__selector-item:last-child { |
||||
/* #ifndef APP-NVUE */ |
||||
border-bottom: none; |
||||
/* #endif */ |
||||
} |
||||
|
||||
// picker 弹出层通用的指示小三角 |
||||
.uni-popper__arrow, |
||||
.uni-popper__arrow::after { |
||||
position: absolute; |
||||
display: block; |
||||
width: 0; |
||||
height: 0; |
||||
border-color: transparent; |
||||
border-style: solid; |
||||
border-width: 6px; |
||||
} |
||||
|
||||
.uni-popper__arrow { |
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); |
||||
top: -6px; |
||||
left: 10%; |
||||
margin-right: 3px; |
||||
border-top-width: 0; |
||||
border-bottom-color: #EBEEF5; |
||||
} |
||||
|
||||
.uni-popper__arrow::after { |
||||
content: " "; |
||||
top: 1px; |
||||
margin-left: -6px; |
||||
border-top-width: 0; |
||||
border-bottom-color: #fff; |
||||
} |
||||
|
||||
.superwei-combox__no-border { |
||||
border: none; |
||||
} |
||||
</style> |
@ -1,89 +0,0 @@
|
||||
{ |
||||
"id": "superwei-combox", |
||||
"displayName": "superwei-combox 组合框", |
||||
"version": "1.0.9", |
||||
"description": "下拉搜索选择组合框,基于官方uni-combox组件,解决选择后再次选择不展示全部选项的问题,支持模糊搜索和JSON数组格式,可设置选中项文字和背景颜色(若使用请一定下载uni_modules版本)", |
||||
"keywords": [ |
||||
"combox", |
||||
"组合框", |
||||
"select", |
||||
"下拉选择", |
||||
"搜索选择" |
||||
], |
||||
"repository": "", |
||||
"engines": { |
||||
}, |
||||
"directories": { |
||||
"example": "../../temps/example_temps" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"前端组件", |
||||
"通用组件" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "无", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": [ |
||||
"uni-scss", |
||||
"uni-icons" |
||||
], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "n" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y" |
||||
}, |
||||
"快应用": { |
||||
"华为": "u", |
||||
"联盟": "u" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,77 +0,0 @@
|
||||
## 基本用法 |
||||
在 ``template`` 中使用组件 |
||||
```html |
||||
<superwei-combox :candidates="candidates" placeholder="请选择或输入" v-model="inputValue" @input="input" @select="select"></superwei-combox> |
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
candidates: ['选项一','选项二','选项三','选项四','...'] |
||||
} |
||||
}, |
||||
methods: { |
||||
input(e){ |
||||
console.log(e) // 选项一 |
||||
}, |
||||
select(e){ |
||||
console.log(e) // 选项一 |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<superwei-combox :candidates="candidates" :isJSON="true" keyName="name" placeholder="请选择或输入" v-model="inputValue" @input="input" @select="select"></superwei-combox> |
||||
<script> |
||||
export default { |
||||
data() { |
||||
return { |
||||
candidates: [{ |
||||
id: '1', |
||||
name: '选项一' |
||||
}, { |
||||
id: '2', |
||||
name: '选项二', |
||||
disabled: true // 单独设置disabled后即可禁用该选项 |
||||
}, { |
||||
id: '3', |
||||
name: '...' |
||||
}] |
||||
} |
||||
}, |
||||
methods: { |
||||
input(e){ |
||||
console.log(e) // 选项一 |
||||
}, |
||||
select(e){ |
||||
console.log(e) // {id: '1',name: '选项一'} |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
``` |
||||
|
||||
## API |
||||
|
||||
### Combox Props |
||||
|
||||
|属性名 |类型 |默认值 |说明 | |
||||
|:-: |:-: |:-: |:-: | |
||||
|label |String |- |标签文字 | |
||||
|value |String |- |combox的值 | |
||||
|labelWidth |String |auto |标签宽度,有单位字符串,如:'100px' | |
||||
|placeholder|String |- |输入框占位符 | |
||||
|candidates |Array/String |[] |候选字段 | |
||||
|emptyTips |String |无匹配项 |无匹配项时的提示语 | |
||||
|selectedBackground |String |#f5f7fa |选中项背景颜色 | |
||||
|selectedColor |String |#409eff |选中项文字颜色 | |
||||
|isJSON |Boolean |false |候选字段是否是json数组 | |
||||
|keyName |String |- |json数组显示的字段值 | |
||||
|disabledColor |String |#ababac |禁用项文字颜色 | |
||||
|isAllowCreate |Boolean |true |是否允许用户创建新条目 | |
||||
|
||||
### Combox Events |
||||
|
||||
|事件称名 |说明 |返回值 | |
||||
|:-: |:-: |:-: | |
||||
|@input |combox输入事件 |返回combox输入值| |
||||
|@select|combox选择事件 |返回combox选项值| |
@ -1,15 +0,0 @@
|
||||
## 1.0.1(2021-11-23) |
||||
- 优化 label、label-width 属性 |
||||
## 1.0.0(2021-11-19) |
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-combox](https://uniapp.dcloud.io/component/uniui/uni-combox) |
||||
## 0.1.0(2021-07-30) |
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
||||
## 0.0.6(2021-05-12) |
||||
- 新增 组件示例地址 |
||||
## 0.0.5(2021-04-21) |
||||
- 优化 添加依赖 uni-icons, 导入后自动下载依赖 |
||||
## 0.0.4(2021-02-05) |
||||
- 优化 组件引用关系,通过uni_modules引用组件 |
||||
## 0.0.3(2021-02-04) |
||||
- 调整为uni_modules目录规范 |
@ -1,335 +0,0 @@
|
||||
<template> |
||||
<view class="uni-combox" :class="border ? '' : 'uni-combox__no-border'"> |
||||
<view class="uni-combox__selector" v-if="showSelector"> |
||||
<view class="uni-popper__arrow"></view> |
||||
<scroll-view scroll-y="true" class="uni-combox__selector-scroll"> |
||||
<view class="uni-combox__selector-empty" v-if="filterCandidatesLength === 0"> |
||||
<text>{{emptyTips}}</text> |
||||
</view> |
||||
<view class="uni-combox__selector-item" v-for="(item,index) in filterCandidates" :key="index" |
||||
@click="onSelectorClick(index)"> |
||||
<text>{{item[`${labelKey}`]}}</text> |
||||
</view> |
||||
</scroll-view> |
||||
</view> |
||||
<view v-if="false" class="uni-combox__label" :style="labelStyle"> |
||||
<text>{{label}}</text> |
||||
</view> |
||||
<view class="uni-combox__input-box"> |
||||
<input class="uni-combox__input" type="text" :placeholder="placeholder" |
||||
placeholder-class="uni-combox__input-plac" v-model="inputVal" @input="onInput" @focus="onFocus" |
||||
@blur="onBlur" /> |
||||
<uni-icons :type="showSelector? 'top' : 'bottom'" size="14" color="#999" @click="toggleSelector"> |
||||
</uni-icons> |
||||
</view> |
||||
|
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* Combox 组合输入框 |
||||
* @description 组合输入框一般用于既可以输入也可以选择的场景 |
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=1261 |
||||
* @property {String} label 左侧文字 |
||||
* @property {String} labelWidth 左侧内容宽度 |
||||
* @property {String} placeholder 输入框占位符 |
||||
* @property {Array} candidates 候选项列表 |
||||
* @property {String} emptyTips 筛选结果为空时显示的文字 |
||||
* @property {String} value 组合框的值 |
||||
*/ |
||||
export default { |
||||
name: 'uniCombox', |
||||
emits: ['input', 'update:modelValue'], |
||||
props: { |
||||
border: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
label: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
labelWidth: { |
||||
type: String, |
||||
default: 'auto' |
||||
}, |
||||
placeholder: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
candidates: { |
||||
type: Array, |
||||
default () { |
||||
return [] |
||||
} |
||||
}, |
||||
emptyTips: { |
||||
type: String, |
||||
default: '无匹配项' |
||||
}, |
||||
labelKey: { |
||||
type: String, |
||||
default: 'dictName' |
||||
}, |
||||
valueKey:{ |
||||
type: String, |
||||
default: 'dictId' |
||||
}, |
||||
// #ifndef VUE3 |
||||
value: { |
||||
type: [String, Number], |
||||
default: '' |
||||
}, |
||||
// #endif |
||||
// #ifdef VUE3 |
||||
modelValue: { |
||||
type: [String, Number], |
||||
default: '' |
||||
}, |
||||
// #endif |
||||
}, |
||||
data() { |
||||
return { |
||||
showSelector: false, |
||||
inputVal: '', |
||||
dictVal:"", |
||||
filterCandidates:[] |
||||
} |
||||
}, |
||||
computed: { |
||||
labelStyle() { |
||||
if (this.labelWidth === 'auto') { |
||||
return "" |
||||
} |
||||
return `width: ${this.labelWidth}` |
||||
}, |
||||
// 为了点击选择能够显示所有选项,把这个filterCandidates放在data中 |
||||
// filterCandidates() { |
||||
// return this.candidates.filter((item) => { |
||||
// console.log(item,this.labelKey) |
||||
// return item[`${this.labelKey}`].toString().indexOf(this.inputVal) > -1 |
||||
// }) |
||||
// }, |
||||
filterCandidatesLength() { |
||||
return this.filterCandidates.length |
||||
} |
||||
}, |
||||
watch: { |
||||
// #ifndef VUE3 |
||||
value: { |
||||
handler(newVal) { |
||||
this.dictVal = newVal |
||||
}, |
||||
immediate: true |
||||
}, |
||||
// #endif |
||||
// #ifndef VUE3 |
||||
// 因为获取列表是个异步的过程,需要对列表进行监听 |
||||
candidates: function(arr){ |
||||
if(arr.length>0 && this.dictVal){ |
||||
let obj = arr.find((item,index) => { |
||||
return this.dictVal == item[`${this.valueKey}`] |
||||
}) |
||||
this.inputVal = obj[`${this.labelKey}`] |
||||
|
||||
} |
||||
this.filterCandidates = arr.filter((item) => { |
||||
return item[`${this.labelKey}`].toString().indexOf(this.inputVal) > -1 |
||||
}) |
||||
console.log("#####",this.filterCandidates) |
||||
}, |
||||
// #endif |
||||
// #ifdef VUE3 |
||||
modelValue: { |
||||
handler(newVal) { |
||||
// this.inputVal = newVal |
||||
if( this.candidates.length>0){ |
||||
let obj = this.candidates.find((item,index) => { |
||||
return newVal == item[`${this.valueKey}`] |
||||
}) |
||||
this.inputVal = obj[`${this.labelKey}`] |
||||
} |
||||
}, |
||||
immediate: true |
||||
}, |
||||
// #endif |
||||
// #ifdef VUE3 |
||||
modelValue: { |
||||
handler(newVal) { |
||||
// this.inputVal = newVal |
||||
if( this.candidates.length>0){ |
||||
let obj = this.candidates.find((item,index) => { |
||||
return newVal == item[`${this.valueKey}`] |
||||
}) |
||||
this.inputVal = obj[`${this.labelKey}`] |
||||
} |
||||
}, |
||||
immediate: true |
||||
}, |
||||
// #endif |
||||
}, |
||||
methods: { |
||||
toggleSelector() { |
||||
this.showSelector = !this.showSelector |
||||
}, |
||||
onFocus() { |
||||
this.filterCandidates = this.candidates |
||||
this.showSelector = true |
||||
|
||||
}, |
||||
onBlur() { |
||||
setTimeout(() => { |
||||
this.showSelector = false |
||||
|
||||
}, 153) |
||||
}, |
||||
onSelectorClick(index) { |
||||
this.dictVal = this.filterCandidates[index][`${this.valueKey}`] |
||||
//this.dictVal 的赋值一定要在this.inputVal前执行, |
||||
//因为this.filterCandidates会监听this.inputVal的变化被重新赋值 |
||||
//这样在选择列表中非第一个选项会报错 |
||||
this.inputVal = this.filterCandidates[index][`${this.labelKey}`] |
||||
this.showSelector = false |
||||
this.$emit('input',this.dictVal) |
||||
this.$emit('update:modelValue', this.dictVal) |
||||
}, |
||||
onInput() { |
||||
this.filterCandidates = this.candidates.filter((item) => { |
||||
// console.log(item,this.labelKey) |
||||
return item[`${this.labelKey}`].toString().indexOf(this.inputVal) > -1 |
||||
}) |
||||
setTimeout(() => { |
||||
this.$emit('input', this.dictVal) |
||||
this.$emit('update:modelValue', this.dictVal) |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" > |
||||
.uni-combox { |
||||
font-size: 14px; |
||||
border: 1px solid #DCDFE6; |
||||
border-radius: 4px; |
||||
padding: 6px 10px; |
||||
position: relative; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
// height: 40px; |
||||
flex-direction: row; |
||||
align-items: center; |
||||
// border-bottom: solid 1px #DDDDDD; |
||||
} |
||||
|
||||
.uni-combox__label { |
||||
font-size: 16px; |
||||
line-height: 22px; |
||||
padding-right: 10px; |
||||
color: #999999; |
||||
} |
||||
|
||||
.uni-combox__input-box { |
||||
position: relative; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex: 1; |
||||
flex-direction: row; |
||||
align-items: center; |
||||
} |
||||
|
||||
.uni-combox__input { |
||||
flex: 1; |
||||
font-size: 14px; |
||||
height: 22px; |
||||
line-height: 22px; |
||||
} |
||||
|
||||
.uni-combox__input-plac { |
||||
font-size: 14px; |
||||
color: #999; |
||||
} |
||||
|
||||
.uni-combox__selector { |
||||
/* #ifndef APP-NVUE */ |
||||
box-sizing: border-box; |
||||
/* #endif */ |
||||
position: absolute; |
||||
top: calc(100% + 12px); |
||||
left: 0; |
||||
width: 100%; |
||||
background-color: #FFFFFF; |
||||
border: 1px solid #EBEEF5; |
||||
border-radius: 6px; |
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
||||
z-index: 99; |
||||
padding: 4px 0; |
||||
} |
||||
|
||||
.uni-combox__selector-scroll { |
||||
/* #ifndef APP-NVUE */ |
||||
max-height: 200px; |
||||
box-sizing: border-box; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.uni-combox__selector-empty, |
||||
.uni-combox__selector-item { |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
cursor: pointer; |
||||
/* #endif */ |
||||
line-height: 36px; |
||||
font-size: 14px; |
||||
text-align: center; |
||||
// border-bottom: solid 1px #DDDDDD; |
||||
padding: 0px 10px; |
||||
} |
||||
|
||||
.uni-combox__selector-item:hover { |
||||
background-color: #f9f9f9; |
||||
} |
||||
|
||||
.uni-combox__selector-empty:last-child, |
||||
.uni-combox__selector-item:last-child { |
||||
/* #ifndef APP-NVUE */ |
||||
border-bottom: none; |
||||
/* #endif */ |
||||
} |
||||
|
||||
// picker 弹出层通用的指示小三角 |
||||
.uni-popper__arrow, |
||||
.uni-popper__arrow::after { |
||||
position: absolute; |
||||
display: block; |
||||
width: 0; |
||||
height: 0; |
||||
border-color: transparent; |
||||
border-style: solid; |
||||
border-width: 6px; |
||||
} |
||||
|
||||
.uni-popper__arrow { |
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); |
||||
top: -6px; |
||||
left: 10%; |
||||
margin-right: 3px; |
||||
border-top-width: 0; |
||||
border-bottom-color: #EBEEF5; |
||||
} |
||||
|
||||
.uni-popper__arrow::after { |
||||
content: " "; |
||||
top: 1px; |
||||
margin-left: -6px; |
||||
border-top-width: 0; |
||||
border-bottom-color: #fff; |
||||
} |
||||
|
||||
.uni-combox__no-border { |
||||
border: none; |
||||
} |
||||
</style> |
@ -1,90 +0,0 @@
|
||||
{ |
||||
"id": "uni-combox", |
||||
"displayName": "uni-combox 组合框", |
||||
"version": "1.0.1", |
||||
"description": "可以选择也可以输入的表单项 ", |
||||
"keywords": [ |
||||
"uni-ui", |
||||
"uniui", |
||||
"combox", |
||||
"组合框", |
||||
"select" |
||||
], |
||||
"repository": "https://github.com/dcloudio/uni-ui", |
||||
"engines": { |
||||
"HBuilderX": "" |
||||
}, |
||||
"directories": { |
||||
"example": "../../temps/example_temps" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"前端组件", |
||||
"通用组件" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "无", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": [ |
||||
"uni-scss", |
||||
"uni-icons" |
||||
], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "n" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y" |
||||
}, |
||||
"快应用": { |
||||
"华为": "u", |
||||
"联盟": "u" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,11 +0,0 @@
|
||||
|
||||
|
||||
## Combox 组合框 |
||||
> **组件名:uni-combox** |
||||
> 代码块: `uCombox` |
||||
|
||||
|
||||
组合框组件。 |
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-combox) |
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
@ -1,64 +0,0 @@
|
||||
## 1.0.7(2022-07-06) |
||||
- 优化 pc端图标位置不正确的问题 |
||||
## 1.0.6(2022-07-05) |
||||
- 优化 显示样式 |
||||
## 1.0.5(2022-07-04) |
||||
- 修复 uni-data-picker 在 uni-forms-item 中宽度不正确的bug |
||||
## 1.0.4(2022-04-19) |
||||
- 修复 字节小程序 本地数据无法选择下一级的Bug |
||||
## 1.0.3(2022-02-25) |
||||
- 修复 nvue 不支持的 v-show 的 bug |
||||
## 1.0.2(2022-02-25) |
||||
- 修复 条件编译 nvue 不支持的 css 样式 |
||||
## 1.0.1(2021-11-23) |
||||
- 修复 由上个版本引发的map、v-model等属性不生效的bug |
||||
## 1.0.0(2021-11-19) |
||||
- 优化 组件 UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-data-picker](https://uniapp.dcloud.io/component/uniui/uni-data-picker) |
||||
## 0.4.9(2021-10-28) |
||||
- 修复 VUE2 v-model 概率无效的 bug |
||||
## 0.4.8(2021-10-27) |
||||
- 修复 v-model 概率无效的 bug |
||||
## 0.4.7(2021-10-25) |
||||
- 新增 属性 spaceInfo 服务空间配置 HBuilderX 3.2.11+ |
||||
- 修复 树型 uniCloud 数据类型为 int 时报错的 bug |
||||
## 0.4.6(2021-10-19) |
||||
- 修复 非 VUE3 v-model 为 0 时无法选中的 bug |
||||
## 0.4.5(2021-09-26) |
||||
- 新增 清除已选项的功能(通过 clearIcon 属性配置是否显示按钮),同时提供 clear 方法以供调用,二者等效 |
||||
- 修复 readonly 为 true 时报错的 bug |
||||
## 0.4.4(2021-09-26) |
||||
- 修复 上一版本造成的 map 属性失效的 bug |
||||
- 新增 ellipsis 属性,支持配置 tab 选项长度过长时是否自动省略 |
||||
## 0.4.3(2021-09-24) |
||||
- 修复 某些情况下级联未触发的 bug |
||||
## 0.4.2(2021-09-23) |
||||
- 新增 提供 show 和 hide 方法,开发者可以通过 ref 调用 |
||||
- 新增 选项内容过长自动添加省略号 |
||||
## 0.4.1(2021-09-15) |
||||
- 新增 map 属性 字段映射,将 text/value 映射到数据中的其他字段 |
||||
## 0.4.0(2021-07-13) |
||||
- 组件兼容 vue3,如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
||||
## 0.3.5(2021-06-04) |
||||
- 修复 无法加载云端数据的问题 |
||||
## 0.3.4(2021-05-28) |
||||
- 修复 v-model 无效问题 |
||||
- 修复 loaddata 为空数据组时加载时间过长问题 |
||||
- 修复 上个版本引出的本地数据无法选择带有 children 的 2 级节点 |
||||
## 0.3.3(2021-05-12) |
||||
- 新增 组件示例地址 |
||||
## 0.3.2(2021-04-22) |
||||
- 修复 非树形数据有 where 属性查询报错的问题 |
||||
## 0.3.1(2021-04-15) |
||||
- 修复 本地数据概率无法回显时问题 |
||||
## 0.3.0(2021-04-07) |
||||
- 新增 支持云端非树形表结构数据 |
||||
- 修复 根节点 parent_field 字段等于 null 时选择界面错乱问题 |
||||
## 0.2.0(2021-03-15) |
||||
- 修复 nodeclick、popupopened、popupclosed 事件无法触发的问题 |
||||
## 0.1.9(2021-03-09) |
||||
- 修复 微信小程序某些情况下无法选择的问题 |
||||
## 0.1.8(2021-02-05) |
||||
- 优化 部分样式在 nvue 上的兼容表现 |
||||
## 0.1.7(2021-02-05) |
||||
- 调整为 uni_modules 目录规范 |
@ -1,45 +0,0 @@
|
||||
// #ifdef H5
|
||||
export default { |
||||
name: 'Keypress', |
||||
props: { |
||||
disable: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
mounted () { |
||||
const keyNames = { |
||||
esc: ['Esc', 'Escape'], |
||||
tab: 'Tab', |
||||
enter: 'Enter', |
||||
space: [' ', 'Spacebar'], |
||||
up: ['Up', 'ArrowUp'], |
||||
left: ['Left', 'ArrowLeft'], |
||||
right: ['Right', 'ArrowRight'], |
||||
down: ['Down', 'ArrowDown'], |
||||
delete: ['Backspace', 'Delete', 'Del'] |
||||
} |
||||
const listener = ($event) => { |
||||
if (this.disable) { |
||||
return |
||||
} |
||||
const keyName = Object.keys(keyNames).find(key => { |
||||
const keyName = $event.key |
||||
const value = keyNames[key] |
||||
return value === keyName || (Array.isArray(value) && value.includes(keyName)) |
||||
}) |
||||
if (keyName) { |
||||
// 避免和其他按键事件冲突
|
||||
setTimeout(() => { |
||||
this.$emit(keyName, {}) |
||||
}, 0) |
||||
} |
||||
} |
||||
document.addEventListener('keyup', listener) |
||||
this.$once('hook:beforeDestroy', () => { |
||||
document.removeEventListener('keyup', listener) |
||||
}) |
||||
}, |
||||
render: () => {} |
||||
} |
||||
// #endif
|
@ -1,557 +0,0 @@
|
||||
<template> |
||||
<view class="uni-data-tree"> |
||||
<view class="uni-data-tree-input" @click="handleInput"> |
||||
<slot :options="options" :data="inputSelected" :error="errorMessage"> |
||||
<view class="input-value" :class="{'input-value-border': border}"> |
||||
<text v-if="errorMessage" class="selected-area error-text">{{errorMessage}}</text> |
||||
<view v-else-if="loading && !isOpened" class="selected-area"> |
||||
<uni-load-more class="load-more" :contentText="loadMore" status="loading"></uni-load-more> |
||||
</view> |
||||
<scroll-view v-else-if="inputSelected.length" class="selected-area" scroll-x="true"> |
||||
<view class="selected-list"> |
||||
<view class="selected-item" v-for="(item,index) in inputSelected" :key="index"> |
||||
<text class="text-color">{{item.text}}</text><text v-if="index<inputSelected.length-1" |
||||
class="input-split-line">{{split}}</text> |
||||
</view> |
||||
</view> |
||||
</scroll-view> |
||||
<text v-else class="selected-area placeholder">{{placeholder}}</text> |
||||
<view v-if="clearIcon && !readonly && inputSelected.length" class="icon-clear" |
||||
@click.stop="clear"> |
||||
<uni-icons type="clear" color="#c0c4cc" size="24"></uni-icons> |
||||
</view> |
||||
<view class="arrow-area" v-if="(!clearIcon || !inputSelected.length) && !readonly "> |
||||
<img src="@/static/task/list.png" alt="" class="input-arrow"> |
||||
</view> |
||||
</view> |
||||
</slot> |
||||
</view> |
||||
<view class="uni-data-tree-cover" v-if="isOpened" @click="handleClose"></view> |
||||
<view class="uni-data-tree-dialog" v-if="isOpened"> |
||||
<view class="uni-popper__arrow"></view> |
||||
<view class="dialog-caption"> |
||||
<view class="title-area"> |
||||
<text class="dialog-title">{{popupTitle}}</text> |
||||
</view> |
||||
<view class="dialog-close" @click="handleClose"> |
||||
<view class="dialog-close-plus" data-id="close"></view> |
||||
<view class="dialog-close-plus dialog-close-rotate" data-id="close"></view> |
||||
</view> |
||||
</view> |
||||
<data-picker-view class="picker-view" ref="pickerView" v-model="dataValue" :localdata="localdata" |
||||
:preload="preload" :collection="collection" :field="field" :orderby="orderby" :where="where" |
||||
:step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true" |
||||
:map="map" :ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick"> |
||||
</data-picker-view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import dataPicker from "../uni-data-pickerview/uni-data-picker.js" |
||||
import DataPickerView from "../uni-data-pickerview/uni-data-pickerview.vue" |
||||
|
||||
/** |
||||
* DataPicker 级联选择 |
||||
* @description 支持单列、和多列级联选择。列数没有限制,如果屏幕显示不全,顶部tab区域会左右滚动。 |
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796 |
||||
* @property {String} popup-title 弹出窗口标题 |
||||
* @property {Array} localdata 本地数据,参考 |
||||
* @property {Boolean} border = [true|false] 是否有边框 |
||||
* @property {Boolean} readonly = [true|false] 是否仅读 |
||||
* @property {Boolean} preload = [true|false] 是否预加载数据 |
||||
* @value true 开启预加载数据,点击弹出窗口后显示已加载数据 |
||||
* @value false 关闭预加载数据,点击弹出窗口后开始加载数据 |
||||
* @property {Boolean} step-searh = [true|false] 是否分布查询 |
||||
* @value true 启用分布查询,仅查询当前选中节点 |
||||
* @value false 关闭分布查询,一次查询出所有数据 |
||||
* @property {String|DBFieldString} self-field 分布查询当前字段名称 |
||||
* @property {String|DBFieldString} parent-field 分布查询父字段名称 |
||||
* @property {String|DBCollectionString} collection 表名 |
||||
* @property {String|DBFieldString} field 查询字段,多个字段用 `,` 分割 |
||||
* @property {String} orderby 排序字段及正序倒叙设置 |
||||
* @property {String|JQLString} where 查询条件 |
||||
* @event {Function} popupshow 弹出的选择窗口打开时触发此事件 |
||||
* @event {Function} popuphide 弹出的选择窗口关闭时触发此事件 |
||||
*/ |
||||
export default { |
||||
name: 'UniDataPicker', |
||||
emits: ['popupopened', 'popupclosed', 'nodeclick', 'input', 'change', 'update:modelValue'], |
||||
mixins: [dataPicker], |
||||
components: { |
||||
DataPickerView |
||||
}, |
||||
props: { |
||||
options: { |
||||
type: [Object, Array], |
||||
default () { |
||||
return {} |
||||
} |
||||
}, |
||||
popupTitle: { |
||||
type: String, |
||||
default: '请选择' |
||||
}, |
||||
placeholder: { |
||||
type: String, |
||||
default: '请选择' |
||||
}, |
||||
heightMobile: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
readonly: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
clearIcon: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
border: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
split: { |
||||
type: String, |
||||
default: '/' |
||||
}, |
||||
ellipsis: { |
||||
type: Boolean, |
||||
default: true |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
isOpened: false, |
||||
inputSelected: [] |
||||
} |
||||
}, |
||||
created() { |
||||
this.form = this.getForm('uniForms') |
||||
this.formItem = this.getForm('uniFormsItem') |
||||
if (this.formItem) { |
||||
if (this.formItem.name) { |
||||
this.rename = this.formItem.name |
||||
this.form.inputChildrens.push(this) |
||||
} |
||||
} |
||||
|
||||
this.$nextTick(() => { |
||||
this.load() |
||||
}) |
||||
}, |
||||
methods: { |
||||
clear() { |
||||
this.inputSelected.splice(0) |
||||
this._dispatchEvent([]) |
||||
}, |
||||
onPropsChange() { |
||||
this._treeData = [] |
||||
this.selectedIndex = 0 |
||||
this.load() |
||||
}, |
||||
load() { |
||||
if (this.readonly) { |
||||
this._processReadonly(this.localdata, this.dataValue) |
||||
return |
||||
} |
||||
|
||||
if (this.isLocaldata) { |
||||
this.loadData() |
||||
this.inputSelected = this.selected.slice(0) |
||||
} else if (!this.parentField && !this.selfField && this.hasValue) { |
||||
this.getNodeData(() => { |
||||
this.inputSelected = this.selected.slice(0) |
||||
}) |
||||
} else if (this.hasValue) { |
||||
this.getTreePath(() => { |
||||
this.inputSelected = this.selected.slice(0) |
||||
}) |
||||
} |
||||
}, |
||||
getForm(name = 'uniForms') { |
||||
let parent = this.$parent; |
||||
let parentName = parent.$options.name; |
||||
while (parentName !== name) { |
||||
parent = parent.$parent; |
||||
if (!parent) return false; |
||||
parentName = parent.$options.name; |
||||
} |
||||
return parent; |
||||
}, |
||||
show() { |
||||
this.isOpened = true |
||||
setTimeout(() => { |
||||
this.$refs.pickerView.updateData({ |
||||
treeData: this._treeData, |
||||
selected: this.selected, |
||||
selectedIndex: this.selectedIndex |
||||
}) |
||||
}, 200) |
||||
this.$emit('popupopened') |
||||
}, |
||||
hide() { |
||||
this.isOpened = false |
||||
this.$emit('popupclosed') |
||||
}, |
||||
handleInput() { |
||||
if (this.readonly) { |
||||
return |
||||
} |
||||
this.show() |
||||
}, |
||||
handleClose(e) { |
||||
this.hide() |
||||
}, |
||||
onnodeclick(e) { |
||||
this.$emit('nodeclick', e) |
||||
}, |
||||
ondatachange(e) { |
||||
this._treeData = this.$refs.pickerView._treeData |
||||
}, |
||||
onchange(e) { |
||||
this.hide() |
||||
this.$nextTick(() => { |
||||
this.inputSelected = e; |
||||
}) |
||||
this._dispatchEvent(e) |
||||
}, |
||||
_processReadonly(dataList, value) { |
||||
var isTree = dataList.findIndex((item) => { |
||||
return item.children |
||||
}) |
||||
if (isTree > -1) { |
||||
let inputValue |
||||
if (Array.isArray(value)) { |
||||
inputValue = value[value.length - 1] |
||||
if (typeof inputValue === 'object' && inputValue.value) { |
||||
inputValue = inputValue.value |
||||
} |
||||
} else { |
||||
inputValue = value |
||||
} |
||||
this.inputSelected = this._findNodePath(inputValue, this.localdata) |
||||
return |
||||
} |
||||
|
||||
if (!this.hasValue) { |
||||
this.inputSelected = [] |
||||
return |
||||
} |
||||
|
||||
let result = [] |
||||
for (let i = 0; i < value.length; i++) { |
||||
var val = value[i] |
||||
var item = dataList.find((v) => { |
||||
return v.value == val |
||||
}) |
||||
if (item) { |
||||
result.push(item) |
||||
} |
||||
} |
||||
if (result.length) { |
||||
this.inputSelected = result |
||||
} |
||||
}, |
||||
_filterForArray(data, valueArray) { |
||||
var result = [] |
||||
for (let i = 0; i < valueArray.length; i++) { |
||||
var value = valueArray[i] |
||||
var found = data.find((item) => { |
||||
return item.value == value |
||||
}) |
||||
if (found) { |
||||
result.push(found) |
||||
} |
||||
} |
||||
return result |
||||
}, |
||||
_dispatchEvent(selected) { |
||||
let item = {} |
||||
if (selected.length) { |
||||
var value = new Array(selected.length) |
||||
for (var i = 0; i < selected.length; i++) { |
||||
value[i] = selected[i].value |
||||
} |
||||
item = selected[selected.length - 1] |
||||
} else { |
||||
item.value = '' |
||||
} |
||||
if (this.formItem) { |
||||
this.formItem.setValue(item.value) |
||||
} |
||||
|
||||
this.$emit('input', item.value) |
||||
this.$emit('update:modelValue', item.value) |
||||
this.$emit('change', { |
||||
detail: { |
||||
value: selected |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style > |
||||
.uni-data-tree { |
||||
flex: 1; |
||||
position: relative; |
||||
font-size: 14px; |
||||
} |
||||
|
||||
.error-text { |
||||
color: #DD524D; |
||||
} |
||||
|
||||
.input-value { |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
align-items: center; |
||||
flex-wrap: nowrap; |
||||
font-size: 14px; |
||||
width: 400rpx; |
||||
/* line-height: 35px; */ |
||||
padding: 0 10px; |
||||
padding-right: 5px; |
||||
overflow: hidden; |
||||
height: 35px; |
||||
/* #ifdef APP-NVUE */ |
||||
/* #endif */ |
||||
box-sizing: border-box; |
||||
} |
||||
|
||||
.input-value-border { |
||||
border: 1px solid #e5e5e5; |
||||
/* border-radius: 5px; */ |
||||
} |
||||
|
||||
.selected-area { |
||||
flex: 1; |
||||
overflow: hidden; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
} |
||||
|
||||
.load-more { |
||||
/* #ifndef APP-NVUE */ |
||||
margin-right: auto; |
||||
/* #endif */ |
||||
/* #ifdef APP-NVUE */ |
||||
width: 40px; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.selected-list { |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
flex-wrap: nowrap; |
||||
/* padding: 0 5px; */ |
||||
} |
||||
|
||||
.selected-item { |
||||
flex-direction: row; |
||||
/* padding: 0 1px; */ |
||||
/* #ifndef APP-NVUE */ |
||||
white-space: nowrap; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.text-color { |
||||
color: #333; |
||||
} |
||||
|
||||
.placeholder { |
||||
color: grey; |
||||
font-size: 12px; |
||||
} |
||||
|
||||
.input-split-line { |
||||
opacity: .5; |
||||
} |
||||
|
||||
.arrow-area { |
||||
position: relative; |
||||
width: 20px; |
||||
/* #ifndef APP-NVUE */ |
||||
margin-bottom: 5px; |
||||
margin-left: auto; |
||||
display: flex; |
||||
/* #endif */ |
||||
justify-content: center; |
||||
/* transform: rotate(-45deg); */ |
||||
transform-origin: center; |
||||
} |
||||
|
||||
.input-arrow { |
||||
width: 40rpx; |
||||
height: 40rpx; |
||||
/* border-left: 1px solid #999; |
||||
border-bottom: 1px solid #999; */ |
||||
} |
||||
|
||||
.uni-data-tree-cover { |
||||
position: fixed; |
||||
width: 100vw; |
||||
height: 100vh; |
||||
left: 0; |
||||
top: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
background-color: rgba(0, 0, 0, .4); |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: column; |
||||
z-index: 100; |
||||
} |
||||
|
||||
.uni-data-tree-dialog { |
||||
position: fixed; |
||||
left: 0; |
||||
top: 40%; |
||||
right: 0; |
||||
bottom: 0; |
||||
background-color: #FFFFFF; |
||||
border-top-left-radius: 10px; |
||||
border-top-right-radius: 10px; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: column; |
||||
z-index: 102; |
||||
overflow: hidden; |
||||
/* #ifdef APP-NVUE */ |
||||
width: 100%; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.dialog-caption { |
||||
position: relative; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
/* border-bottom: 1px solid #f0f0f0; */ |
||||
} |
||||
|
||||
.title-area { |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
align-items: center; |
||||
/* #ifndef APP-NVUE */ |
||||
margin: auto; |
||||
/* #endif */ |
||||
padding: 0 10px; |
||||
} |
||||
|
||||
.dialog-title { |
||||
/* font-weight: bold; */ |
||||
line-height: 44px; |
||||
} |
||||
|
||||
.dialog-close { |
||||
position: absolute; |
||||
top: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
align-items: center; |
||||
padding: 0 15px; |
||||
} |
||||
|
||||
.dialog-close-plus { |
||||
width: 16px; |
||||
height: 2px; |
||||
background-color: #666; |
||||
border-radius: 2px; |
||||
transform: rotate(45deg); |
||||
} |
||||
|
||||
.dialog-close-rotate { |
||||
position: absolute; |
||||
transform: rotate(-45deg); |
||||
} |
||||
|
||||
.picker-view { |
||||
flex: 1; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
.icon-clear { |
||||
display: flex; |
||||
align-items: center; |
||||
} |
||||
|
||||
/* #ifdef H5 */ |
||||
@media all and (min-width: 768px) { |
||||
.uni-data-tree-cover { |
||||
background-color: transparent; |
||||
} |
||||
|
||||
.uni-data-tree-dialog { |
||||
position: absolute; |
||||
top: 55px; |
||||
height: auto; |
||||
min-height: 400px; |
||||
max-height: 50vh; |
||||
background-color: #fff; |
||||
border: 1px solid #EBEEF5; |
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); |
||||
border-radius: 4px; |
||||
overflow: unset; |
||||
} |
||||
|
||||
.dialog-caption { |
||||
display: none; |
||||
} |
||||
|
||||
.icon-clear { |
||||
/* margin-right: 5px; */ |
||||
} |
||||
} |
||||
|
||||
/* #endif */ |
||||
|
||||
/* picker 弹出层通用的指示小三角, todo:扩展至上下左右方向定位 */ |
||||
/* #ifndef APP-NVUE */ |
||||
.uni-popper__arrow, |
||||
.uni-popper__arrow::after { |
||||
position: absolute; |
||||
display: block; |
||||
width: 0; |
||||
height: 0; |
||||
border-color: transparent; |
||||
border-style: solid; |
||||
border-width: 6px; |
||||
} |
||||
|
||||
.uni-popper__arrow { |
||||
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); |
||||
top: -6px; |
||||
left: 10%; |
||||
margin-right: 3px; |
||||
border-top-width: 0; |
||||
border-bottom-color: #EBEEF5; |
||||
} |
||||
|
||||
.uni-popper__arrow::after { |
||||
content: " "; |
||||
top: 1px; |
||||
margin-left: -6px; |
||||
border-top-width: 0; |
||||
border-bottom-color: #fff; |
||||
} |
||||
/* #endif */ |
||||
</style> |
@ -1,563 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
localdata: { |
||||
type: [Array, Object], |
||||
default () { |
||||
return [] |
||||
} |
||||
}, |
||||
spaceInfo: { |
||||
type: Object, |
||||
default () { |
||||
return {} |
||||
} |
||||
}, |
||||
collection: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
action: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
field: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
orderby: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
where: { |
||||
type: [String, Object], |
||||
default: '' |
||||
}, |
||||
pageData: { |
||||
type: String, |
||||
default: 'add' |
||||
}, |
||||
pageCurrent: { |
||||
type: Number, |
||||
default: 1 |
||||
}, |
||||
pageSize: { |
||||
type: Number, |
||||
default: 20 |
||||
}, |
||||
getcount: { |
||||
type: [Boolean, String], |
||||
default: false |
||||
}, |
||||
getone: { |
||||
type: [Boolean, String], |
||||
default: false |
||||
}, |
||||
gettree: { |
||||
type: [Boolean, String], |
||||
default: false |
||||
}, |
||||
manual: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
value: { |
||||
type: [Array, String, Number], |
||||
default () { |
||||
return [] |
||||
} |
||||
}, |
||||
modelValue: { |
||||
type: [Array, String, Number], |
||||
default () { |
||||
return [] |
||||
} |
||||
}, |
||||
preload: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
stepSearh: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
selfField: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
parentField: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
multiple: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
map: { |
||||
type: Object, |
||||
default() { |
||||
return { |
||||
text: "text", |
||||
value: "value" |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
loading: false, |
||||
errorMessage: '', |
||||
loadMore: { |
||||
contentdown: '', |
||||
contentrefresh: '', |
||||
contentnomore: '' |
||||
}, |
||||
dataList: [], |
||||
selected: [], |
||||
selectedIndex: 0, |
||||
page: { |
||||
current: this.pageCurrent, |
||||
size: this.pageSize, |
||||
count: 0 |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
isLocaldata() { |
||||
return !this.collection.length |
||||
}, |
||||
postField() { |
||||
let fields = [this.field]; |
||||
if (this.parentField) { |
||||
fields.push(`${this.parentField} as parent_value`); |
||||
} |
||||
return fields.join(','); |
||||
}, |
||||
dataValue() { |
||||
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined) |
||||
return isModelValue ? this.modelValue : this.value |
||||
}, |
||||
hasValue() { |
||||
if (typeof this.dataValue === 'number') { |
||||
return true |
||||
} |
||||
return (this.dataValue != null) && (this.dataValue.length > 0) |
||||
} |
||||
}, |
||||
created() { |
||||
this.$watch(() => { |
||||
var al = []; |
||||
['pageCurrent', |
||||
'pageSize', |
||||
'spaceInfo', |
||||
'value', |
||||
'modelValue', |
||||
'localdata', |
||||
'collection', |
||||
'action', |
||||
'field', |
||||
'orderby', |
||||
'where', |
||||
'getont', |
||||
'getcount', |
||||
'gettree' |
||||
].forEach(key => { |
||||
al.push(this[key]) |
||||
}); |
||||
return al |
||||
}, (newValue, oldValue) => { |
||||
let needReset = false |
||||
for (let i = 2; i < newValue.length; i++) { |
||||
if (newValue[i] != oldValue[i]) { |
||||
needReset = true |
||||
break |
||||
} |
||||
} |
||||
if (newValue[0] != oldValue[0]) { |
||||
this.page.current = this.pageCurrent |
||||
} |
||||
this.page.size = this.pageSize |
||||
|
||||
this.onPropsChange() |
||||
}) |
||||
this._treeData = [] |
||||
}, |
||||
methods: { |
||||
onPropsChange() { |
||||
this._treeData = [] |
||||
}, |
||||
getCommand(options = {}) { |
||||
/* eslint-disable no-undef */ |
||||
let db = uniCloud.database(this.spaceInfo) |
||||
|
||||
const action = options.action || this.action |
||||
if (action) { |
||||
db = db.action(action) |
||||
} |
||||
|
||||
const collection = options.collection || this.collection |
||||
db = db.collection(collection) |
||||
|
||||
const where = options.where || this.where |
||||
if (!(!where || !Object.keys(where).length)) { |
||||
db = db.where(where) |
||||
} |
||||
|
||||
const field = options.field || this.field |
||||
if (field) { |
||||
db = db.field(field) |
||||
} |
||||
|
||||
const orderby = options.orderby || this.orderby |
||||
if (orderby) { |
||||
db = db.orderBy(orderby) |
||||
} |
||||
|
||||
const current = options.pageCurrent !== undefined ? options.pageCurrent : this.page.current |
||||
const size = options.pageSize !== undefined ? options.pageSize : this.page.size |
||||
const getCount = options.getcount !== undefined ? options.getcount : this.getcount |
||||
const getTree = options.gettree !== undefined ? options.gettree : this.gettree |
||||
|
||||
const getOptions = { |
||||
getCount, |
||||
getTree |
||||
} |
||||
if (options.getTreePath) { |
||||
getOptions.getTreePath = options.getTreePath |
||||
} |
||||
|
||||
db = db.skip(size * (current - 1)).limit(size).get(getOptions) |
||||
|
||||
return db |
||||
}, |
||||
getNodeData(callback) { |
||||
if (this.loading) { |
||||
return |
||||
} |
||||
this.loading = true |
||||
this.getCommand({ |
||||
field: this.postField, |
||||
where: this._pathWhere() |
||||
}).then((res) => { |
||||
this.loading = false |
||||
this.selected = res.result.data |
||||
callback && callback() |
||||
}).catch((err) => { |
||||
this.loading = false |
||||
this.errorMessage = err |
||||
}) |
||||
}, |
||||
getTreePath(callback) { |
||||
if (this.loading) { |
||||
return |
||||
} |
||||
this.loading = true |
||||
|
||||
this.getCommand({ |
||||
field: this.postField, |
||||
getTreePath: { |
||||
startWith: `${this.selfField}=='${this.dataValue}'` |
||||
} |
||||
}).then((res) => { |
||||
this.loading = false |
||||
let treePath = [] |
||||
this._extractTreePath(res.result.data, treePath) |
||||
this.selected = treePath |
||||
callback && callback() |
||||
}).catch((err) => { |
||||
this.loading = false |
||||
this.errorMessage = err |
||||
}) |
||||
}, |
||||
loadData() { |
||||
if (this.isLocaldata) { |
||||
this._processLocalData() |
||||
return |
||||
} |
||||
|
||||
if (this.dataValue != null) { |
||||
this._loadNodeData((data) => { |
||||
this._treeData = data |
||||
this._updateBindData() |
||||
this._updateSelected() |
||||
}) |
||||
return |
||||
} |
||||
|
||||
if (this.stepSearh) { |
||||
this._loadNodeData((data) => { |
||||
this._treeData = data |
||||
this._updateBindData() |
||||
}) |
||||
} else { |
||||
this._loadAllData((data) => { |
||||
this._treeData = [] |
||||
this._extractTree(data, this._treeData, null) |
||||
this._updateBindData() |
||||
}) |
||||
} |
||||
}, |
||||
_loadAllData(callback) { |
||||
if (this.loading) { |
||||
return |
||||
} |
||||
this.loading = true |
||||
|
||||
this.getCommand({ |
||||
field: this.postField, |
||||
gettree: true, |
||||
startwith: `${this.selfField}=='${this.dataValue}'` |
||||
}).then((res) => { |
||||
this.loading = false |
||||
callback(res.result.data) |
||||
this.onDataChange() |
||||
}).catch((err) => { |
||||
this.loading = false |
||||
this.errorMessage = err |
||||
}) |
||||
}, |
||||
_loadNodeData(callback, pw) { |
||||
if (this.loading) { |
||||
return |
||||
} |
||||
this.loading = true |
||||
|
||||
this.getCommand({ |
||||
field: this.postField, |
||||
where: pw || this._postWhere(), |
||||
pageSize: 500 |
||||
}).then((res) => { |
||||
this.loading = false |
||||
callback(res.result.data) |
||||
this.onDataChange() |
||||
}).catch((err) => { |
||||
this.loading = false |
||||
this.errorMessage = err |
||||
}) |
||||
}, |
||||
_pathWhere() { |
||||
let result = [] |
||||
let where_field = this._getParentNameByField(); |
||||
if (where_field) { |
||||
result.push(`${where_field} == '${this.dataValue}'`) |
||||
} |
||||
|
||||
if (this.where) { |
||||
return `(${this.where}) && (${result.join(' || ')})` |
||||
} |
||||
|
||||
return result.join(' || ') |
||||
}, |
||||
_postWhere() { |
||||
let result = [] |
||||
let selected = this.selected |
||||
let parentField = this.parentField |
||||
if (parentField) { |
||||
result.push(`${parentField} == null || ${parentField} == ""`) |
||||
} |
||||
if (selected.length) { |
||||
for (var i = 0; i < selected.length - 1; i++) { |
||||
result.push(`${parentField} == '${selected[i].value}'`) |
||||
} |
||||
} |
||||
|
||||
let where = [] |
||||
if (this.where) { |
||||
where.push(`(${this.where})`) |
||||
} |
||||
if (result.length) { |
||||
where.push(`(${result.join(' || ')})`) |
||||
} |
||||
|
||||
return where.join(' && ') |
||||
}, |
||||
_nodeWhere() { |
||||
let result = [] |
||||
let selected = this.selected |
||||
if (selected.length) { |
||||
result.push(`${this.parentField} == '${selected[selected.length - 1].value}'`) |
||||
} |
||||
|
||||
if (this.where) { |
||||
return `(${this.where}) && (${result.join(' || ')})` |
||||
} |
||||
|
||||
return result.join(' || ') |
||||
}, |
||||
_getParentNameByField() { |
||||
const fields = this.field.split(','); |
||||
let where_field = null; |
||||
for (let i = 0; i < fields.length; i++) { |
||||
const items = fields[i].split('as'); |
||||
if (items.length < 2) { |
||||
continue; |
||||
} |
||||
if (items[1].trim() === 'value') { |
||||
where_field = items[0].trim(); |
||||
break; |
||||
} |
||||
} |
||||
return where_field |
||||
}, |
||||
_isTreeView() { |
||||
return (this.parentField && this.selfField) |
||||
}, |
||||
_updateSelected() { |
||||
var dl = this.dataList |
||||
var sl = this.selected |
||||
let textField = this.map.text |
||||
let valueField = this.map.value |
||||
for (var i = 0; i < sl.length; i++) { |
||||
var value = sl[i].value |
||||
var dl2 = dl[i] |
||||
for (var j = 0; j < dl2.length; j++) { |
||||
var item2 = dl2[j] |
||||
if (item2[valueField] === value) { |
||||
sl[i].text = item2[textField] |
||||
break |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
_updateBindData(node) { |
||||
const { |
||||
dataList, |
||||
hasNodes |
||||
} = this._filterData(this._treeData, this.selected) |
||||
|
||||
let isleaf = this._stepSearh === false && !hasNodes |
||||
|
||||
if (node) { |
||||
node.isleaf = isleaf |
||||
} |
||||
|
||||
this.dataList = dataList |
||||
this.selectedIndex = dataList.length - 1 |
||||
|
||||
if (!isleaf && this.selected.length < dataList.length) { |
||||
this.selected.push({ |
||||
value: null, |
||||
text: "请选择" |
||||
}) |
||||
} |
||||
|
||||
return { |
||||
isleaf, |
||||
hasNodes |
||||
} |
||||
}, |
||||
_filterData(data, paths) { |
||||
let dataList = [] |
||||
let hasNodes = true |
||||
|
||||
dataList.push(data.filter((item) => { |
||||
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '') |
||||
})) |
||||
for (let i = 0; i < paths.length; i++) { |
||||
var value = paths[i].value |
||||
var nodes = data.filter((item) => { |
||||
return item.parent_value === value |
||||
}) |
||||
|
||||
if (nodes.length) { |
||||
dataList.push(nodes) |
||||
} else { |
||||
hasNodes = false |
||||
} |
||||
} |
||||
|
||||
return { |
||||
dataList, |
||||
hasNodes |
||||
} |
||||
}, |
||||
_extractTree(nodes, result, parent_value) { |
||||
let list = result || [] |
||||
let valueField = this.map.value |
||||
for (let i = 0; i < nodes.length; i++) { |
||||
let node = nodes[i] |
||||
|
||||
let child = {} |
||||
for (let key in node) { |
||||
if (key !== 'children') { |
||||
child[key] = node[key] |
||||
} |
||||
} |
||||
if (parent_value !== null && parent_value !== undefined && parent_value !== '') { |
||||
child.parent_value = parent_value |
||||
} |
||||
result.push(child) |
||||
|
||||
let children = node.children |
||||
if (children) { |
||||
this._extractTree(children, result, node[valueField]) |
||||
} |
||||
} |
||||
}, |
||||
_extractTreePath(nodes, result) { |
||||
let list = result || [] |
||||
for (let i = 0; i < nodes.length; i++) { |
||||
let node = nodes[i] |
||||
|
||||
let child = {} |
||||
for (let key in node) { |
||||
if (key !== 'children') { |
||||
child[key] = node[key] |
||||
} |
||||
} |
||||
result.push(child) |
||||
|
||||
let children = node.children |
||||
if (children) { |
||||
this._extractTreePath(children, result) |
||||
} |
||||
} |
||||
}, |
||||
_findNodePath(key, nodes, path = []) { |
||||
let textField = this.map.text |
||||
let valueField = this.map.value |
||||
for (let i = 0; i < nodes.length; i++) { |
||||
let node = nodes[i] |
||||
let children = node.children |
||||
let text = node[textField] |
||||
let value = node[valueField] |
||||
|
||||
path.push({ |
||||
value, |
||||
text |
||||
}) |
||||
|
||||
if (value === key) { |
||||
return path |
||||
} |
||||
|
||||
if (children) { |
||||
const p = this._findNodePath(key, children, path) |
||||
if (p.length) { |
||||
return p |
||||
} |
||||
} |
||||
|
||||
path.pop() |
||||
} |
||||
return [] |
||||
}, |
||||
_processLocalData() { |
||||
this._treeData = [] |
||||
this._extractTree(this.localdata, this._treeData) |
||||
|
||||
var inputValue = this.dataValue |
||||
if (inputValue === undefined) { |
||||
return |
||||
} |
||||
|
||||
if (Array.isArray(inputValue)) { |
||||
inputValue = inputValue[inputValue.length - 1] |
||||
if (typeof inputValue === 'object' && inputValue[this.map.value]) { |
||||
inputValue = inputValue[this.map.value] |
||||
} |
||||
} |
||||
|
||||
this.selected = this._findNodePath(inputValue, this.localdata) |
||||
} |
||||
} |
||||
} |
@ -1,333 +0,0 @@
|
||||
<template> |
||||
<view class="uni-data-pickerview"> |
||||
<scroll-view class="selected-area" scroll-x="true" scroll-y="false" :show-scrollbar="false"> |
||||
<view class="selected-list"> |
||||
<template v-for="(item,index) in selected"> |
||||
<view class="selected-item" |
||||
:class="{'selected-item-active':index==selectedIndex, 'selected-item-text-overflow': ellipsis}" |
||||
v-if="item.text" @click="handleSelect(index)"> |
||||
<text class="">{{item.text}}</text> |
||||
</view> |
||||
</template> |
||||
</view> |
||||
</scroll-view> |
||||
<view class="tab-c"> |
||||
<template v-for="(child, i) in dataList" > |
||||
<scroll-view class="list" :key="i" v-if="i==selectedIndex" :scroll-y="true"> |
||||
<view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in child" |
||||
@click="handleNodeClick(item, i, j)"> |
||||
<text class="item-text item-text-overflow">{{item[map.text]}}</text> |
||||
<view class="check" v-if="selected.length > i && item[map.value] == selected[i].value"></view> |
||||
</view> |
||||
</scroll-view> |
||||
</template> |
||||
|
||||
<view class="loading-cover" v-if="loading"> |
||||
<uni-load-more class="load-more" :contentText="loadMore" status="loading"></uni-load-more> |
||||
</view> |
||||
<view class="error-message" v-if="errorMessage"> |
||||
<text class="error-text">{{errorMessage}}</text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import dataPicker from "./uni-data-picker.js" |
||||
|
||||
/** |
||||
* DataPickerview |
||||
* @description uni-data-pickerview |
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=3796 |
||||
* @property {Array} localdata 本地数据,参考 |
||||
* @property {Boolean} step-searh = [true|false] 是否分布查询 |
||||
* @value true 启用分布查询,仅查询当前选中节点 |
||||
* @value false 关闭分布查询,一次查询出所有数据 |
||||
* @property {String|DBFieldString} self-field 分布查询当前字段名称 |
||||
* @property {String|DBFieldString} parent-field 分布查询父字段名称 |
||||
* @property {String|DBCollectionString} collection 表名 |
||||
* @property {String|DBFieldString} field 查询字段,多个字段用 `,` 分割 |
||||
* @property {String} orderby 排序字段及正序倒叙设置 |
||||
* @property {String|JQLString} where 查询条件 |
||||
*/ |
||||
export default { |
||||
name: 'UniDataPickerView', |
||||
emits: ['nodeclick', 'change', 'datachange', 'update:modelValue'], |
||||
mixins: [dataPicker], |
||||
props: { |
||||
managedMode: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
ellipsis: { |
||||
type: Boolean, |
||||
default: true |
||||
} |
||||
}, |
||||
data() { |
||||
return {} |
||||
}, |
||||
created() { |
||||
if (this.managedMode) { |
||||
return |
||||
} |
||||
|
||||
this.$nextTick(() => { |
||||
this.load() |
||||
}) |
||||
}, |
||||
methods: { |
||||
onPropsChange() { |
||||
this._treeData = [] |
||||
this.selectedIndex = 0 |
||||
this.load() |
||||
}, |
||||
load() { |
||||
if (this.isLocaldata) { |
||||
this.loadData() |
||||
} else if (this.dataValue.length) { |
||||
this.getTreePath((res) => { |
||||
this.loadData() |
||||
}) |
||||
} |
||||
}, |
||||
handleSelect(index) { |
||||
this.selectedIndex = index |
||||
}, |
||||
handleNodeClick(item, i, j) { |
||||
if (item.disable) { |
||||
return |
||||
} |
||||
const node = this.dataList[i][j] |
||||
const text = node[this.map.text] |
||||
const value = node[this.map.value] |
||||
if (i < this.selected.length - 1) { |
||||
this.selected.splice(i, this.selected.length - i) |
||||
this.selected.push({ |
||||
text, |
||||
value |
||||
}) |
||||
} else if (i === this.selected.length - 1) { |
||||
this.selected.splice(i, 1, { |
||||
text, |
||||
value |
||||
}) |
||||
} |
||||
|
||||
if (node.isleaf) { |
||||
this.onSelectedChange(node, node.isleaf) |
||||
return |
||||
} |
||||
|
||||
const { |
||||
isleaf, |
||||
hasNodes |
||||
} = this._updateBindData() |
||||
|
||||
if (!this._isTreeView() && !hasNodes) { |
||||
this.onSelectedChange(node, true) |
||||
return |
||||
} |
||||
|
||||
if (this.isLocaldata && (!hasNodes || isleaf)) { |
||||
this.onSelectedChange(node, true) |
||||
return |
||||
} |
||||
|
||||
if (!isleaf && !hasNodes) { |
||||
this._loadNodeData((data) => { |
||||
if (!data.length) { |
||||
node.isleaf = true |
||||
} else { |
||||
this._treeData.push(...data) |
||||
this._updateBindData(node) |
||||
} |
||||
this.onSelectedChange(node, node.isleaf) |
||||
}, this._nodeWhere()) |
||||
return |
||||
} |
||||
|
||||
this.onSelectedChange(node, false) |
||||
}, |
||||
updateData(data) { |
||||
this._treeData = data.treeData |
||||
this.selected = data.selected |
||||
if (!this._treeData.length) { |
||||
this.loadData() |
||||
} else { |
||||
//this.selected = data.selected |
||||
this._updateBindData() |
||||
} |
||||
}, |
||||
onDataChange() { |
||||
this.$emit('datachange') |
||||
}, |
||||
onSelectedChange(node, isleaf) { |
||||
if (isleaf) { |
||||
this._dispatchEvent() |
||||
} |
||||
|
||||
if (node) { |
||||
this.$emit('nodeclick', node) |
||||
} |
||||
}, |
||||
_dispatchEvent() { |
||||
this.$emit('change', this.selected.slice(0)) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
<style > |
||||
.uni-data-pickerview { |
||||
flex: 1; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: column; |
||||
overflow: hidden; |
||||
height: 100%; |
||||
} |
||||
|
||||
.error-text { |
||||
color: #DD524D; |
||||
} |
||||
|
||||
.loading-cover { |
||||
position: absolute; |
||||
left: 0; |
||||
top: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
background-color: rgba(255, 255, 255, .5); |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: column; |
||||
align-items: center; |
||||
z-index: 1001; |
||||
} |
||||
|
||||
.load-more { |
||||
/* #ifndef APP-NVUE */ |
||||
margin: auto; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.error-message { |
||||
background-color: #fff; |
||||
position: absolute; |
||||
left: 0; |
||||
top: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
padding: 15px; |
||||
opacity: .9; |
||||
z-index: 102; |
||||
} |
||||
|
||||
/* #ifdef APP-NVUE */ |
||||
.selected-area { |
||||
width: 750rpx; |
||||
} |
||||
|
||||
/* #endif */ |
||||
|
||||
.selected-list { |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
flex-wrap: nowrap; |
||||
padding: 0 5px; |
||||
border-bottom: 1px solid #f8f8f8; |
||||
} |
||||
|
||||
.selected-item { |
||||
margin-left: 10px; |
||||
margin-right: 10px; |
||||
padding: 12px 0; |
||||
text-align: center; |
||||
/* #ifndef APP-NVUE */ |
||||
white-space: nowrap; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.selected-item-text-overflow { |
||||
width: 168px; |
||||
/* fix nvue */ |
||||
overflow: hidden; |
||||
/* #ifndef APP-NVUE */ |
||||
width: 6em; |
||||
white-space: nowrap; |
||||
text-overflow: ellipsis; |
||||
-o-text-overflow: ellipsis; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.selected-item-active { |
||||
border-bottom: 2px solid #007aff; |
||||
} |
||||
|
||||
.selected-item-text { |
||||
color: #007aff; |
||||
} |
||||
|
||||
.tab-c { |
||||
position: relative; |
||||
flex: 1; |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
overflow: hidden; |
||||
} |
||||
|
||||
.list { |
||||
flex: 1; |
||||
} |
||||
|
||||
.item { |
||||
padding: 12px 15px; |
||||
/* border-bottom: 1px solid #f0f0f0; */ |
||||
/* #ifndef APP-NVUE */ |
||||
display: flex; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
justify-content: space-between; |
||||
} |
||||
|
||||
.is-disabled { |
||||
opacity: .5; |
||||
} |
||||
|
||||
.item-text { |
||||
/* flex: 1; */ |
||||
color: #333333; |
||||
} |
||||
|
||||
.item-text-overflow { |
||||
width: 280px; |
||||
/* fix nvue */ |
||||
overflow: hidden; |
||||
/* #ifndef APP-NVUE */ |
||||
width: 20em; |
||||
white-space: nowrap; |
||||
text-overflow: ellipsis; |
||||
-o-text-overflow: ellipsis; |
||||
/* #endif */ |
||||
} |
||||
|
||||
.check { |
||||
margin-right: 5px; |
||||
border: 2px solid #007aff; |
||||
border-left: 0; |
||||
border-top: 0; |
||||
height: 12px; |
||||
width: 6px; |
||||
transform-origin: center; |
||||
/* #ifndef APP-NVUE */ |
||||
transition: all 0.3s; |
||||
/* #endif */ |
||||
transform: rotate(45deg); |
||||
} |
||||
</style> |
@ -1,93 +0,0 @@
|
||||
{ |
||||
"id": "uni-data-picker", |
||||
"displayName": "uni-data-picker 数据驱动的picker选择器", |
||||
"version": "1.0.7", |
||||
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景", |
||||
"keywords": [ |
||||
"uni-ui", |
||||
"uniui", |
||||
"picker", |
||||
"级联", |
||||
"省市区", |
||||
"" |
||||
], |
||||
"repository": "https://github.com/dcloudio/uni-ui", |
||||
"engines": { |
||||
"HBuilderX": "" |
||||
}, |
||||
"directories": { |
||||
"example": "../../temps/example_temps" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"前端组件", |
||||
"通用组件" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "无", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": [ |
||||
"uni-load-more", |
||||
"uni-icons", |
||||
"uni-scss" |
||||
], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "y" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y", |
||||
"京东": "u" |
||||
}, |
||||
"快应用": { |
||||
"华为": "u", |
||||
"联盟": "u" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,22 +0,0 @@
|
||||
## DataPicker 级联选择 |
||||
> **组件名:uni-data-picker** |
||||
> 代码块: `uDataPicker` |
||||
> 关联组件:`uni-data-pickerview`、`uni-load-more`。 |
||||
|
||||
|
||||
`<uni-data-picker>` 是一个选择类[datacom组件](https://uniapp.dcloud.net.cn/component/datacom)。 |
||||
|
||||
支持单列、和多列级联选择。列数没有限制,如果屏幕显示不全,顶部tab区域会左右滚动。 |
||||
|
||||
候选数据支持一次性加载完毕,也支持懒加载,比如示例图中,选择了“北京”后,动态加载北京的区县数据。 |
||||
|
||||
`<uni-data-picker>` 组件尤其适用于地址选择、分类选择等选择类。 |
||||
|
||||
`<uni-data-picker>` 支持本地数据、云端静态数据(json),uniCloud云数据库数据。 |
||||
|
||||
`<uni-data-picker>` 可以通过JQL直连uniCloud云数据库,配套[DB Schema](https://uniapp.dcloud.net.cn/uniCloud/schema),可在schema2code中自动生成前端页面,还支持服务器端校验。 |
||||
|
||||
在uniCloud数据表中新建表“uni-id-address”和“opendb-city-china”,这2个表的schema自带foreignKey关联。在“uni-id-address”表的表结构页面使用schema2code生成前端页面,会自动生成地址管理的维护页面,自动从“opendb-city-china”表包含的中国所有省市区信息里选择地址。 |
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-data-picker) |
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
@ -1,22 +0,0 @@
|
||||
## 1.3.5(2022-01-24) |
||||
- 优化 size 属性可以传入不带单位的字符串数值 |
||||
## 1.3.4(2022-01-24) |
||||
- 优化 size 支持其他单位 |
||||
## 1.3.3(2022-01-17) |
||||
- 修复 nvue 有些图标不显示的bug,兼容老版本图标 |
||||
## 1.3.2(2021-12-01) |
||||
- 优化 示例可复制图标名称 |
||||
## 1.3.1(2021-11-23) |
||||
- 优化 兼容旧组件 type 值 |
||||
## 1.3.0(2021-11-19) |
||||
- 新增 更多图标 |
||||
- 优化 自定义图标使用方式 |
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-icons](https://uniapp.dcloud.io/component/uniui/uni-icons) |
||||
## 1.1.7(2021-11-08) |
||||
## 1.2.0(2021-07-30) |
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
||||
## 1.1.5(2021-05-12) |
||||
- 新增 组件示例地址 |
||||
## 1.1.4(2021-02-05) |
||||
- 调整为uni_modules目录规范 |
File diff suppressed because it is too large
Load Diff
@ -1,663 +0,0 @@
|
||||
.uniui-color:before { |
||||
content: "\e6cf"; |
||||
} |
||||
|
||||
.uniui-wallet:before { |
||||
content: "\e6b1"; |
||||
} |
||||
|
||||
.uniui-settings-filled:before { |
||||
content: "\e6ce"; |
||||
} |
||||
|
||||
.uniui-auth-filled:before { |
||||
content: "\e6cc"; |
||||
} |
||||
|
||||
.uniui-shop-filled:before { |
||||
content: "\e6cd"; |
||||
} |
||||
|
||||
.uniui-staff-filled:before { |
||||
content: "\e6cb"; |
||||
} |
||||
|
||||
.uniui-vip-filled:before { |
||||
content: "\e6c6"; |
||||
} |
||||
|
||||
.uniui-plus-filled:before { |
||||
content: "\e6c7"; |
||||
} |
||||
|
||||
.uniui-folder-add-filled:before { |
||||
content: "\e6c8"; |
||||
} |
||||
|
||||
.uniui-color-filled:before { |
||||
content: "\e6c9"; |
||||
} |
||||
|
||||
.uniui-tune-filled:before { |
||||
content: "\e6ca"; |
||||
} |
||||
|
||||
.uniui-calendar-filled:before { |
||||
content: "\e6c0"; |
||||
} |
||||
|
||||
.uniui-notification-filled:before { |
||||
content: "\e6c1"; |
||||
} |
||||
|
||||
.uniui-wallet-filled:before { |
||||
content: "\e6c2"; |
||||
} |
||||
|
||||
.uniui-medal-filled:before { |
||||
content: "\e6c3"; |
||||
} |
||||
|
||||
.uniui-gift-filled:before { |
||||
content: "\e6c4"; |
||||
} |
||||
|
||||
.uniui-fire-filled:before { |
||||
content: "\e6c5"; |
||||
} |
||||
|
||||
.uniui-refreshempty:before { |
||||
content: "\e6bf"; |
||||
} |
||||
|
||||
.uniui-location-filled:before { |
||||
content: "\e6af"; |
||||
} |
||||
|
||||
.uniui-person-filled:before { |
||||
content: "\e69d"; |
||||
} |
||||
|
||||
.uniui-personadd-filled:before { |
||||
content: "\e698"; |
||||
} |
||||
|
||||
.uniui-back:before { |
||||
content: "\e6b9"; |
||||
} |
||||
|
||||
.uniui-forward:before { |
||||
content: "\e6ba"; |
||||
} |
||||
|
||||
.uniui-arrow-right:before { |
||||
content: "\e6bb"; |
||||
} |
||||
|
||||
.uniui-arrowthinright:before { |
||||
content: "\e6bb"; |
||||
} |
||||
|
||||
.uniui-arrow-left:before { |
||||
content: "\e6bc"; |
||||
} |
||||
|
||||
.uniui-arrowthinleft:before { |
||||
content: "\e6bc"; |
||||
} |
||||
|
||||
.uniui-arrow-up:before { |
||||
content: "\e6bd"; |
||||
} |
||||
|
||||
.uniui-arrowthinup:before { |
||||
content: "\e6bd"; |
||||
} |
||||
|
||||
.uniui-arrow-down:before { |
||||
content: "\e6be"; |
||||
} |
||||
|
||||
.uniui-arrowthindown:before { |
||||
content: "\e6be"; |
||||
} |
||||
|
||||
.uniui-bottom:before { |
||||
content: "\e6b8"; |
||||
} |
||||
|
||||
.uniui-arrowdown:before { |
||||
content: "\e6b8"; |
||||
} |
||||
|
||||
.uniui-right:before { |
||||
content: "\e6b5"; |
||||
} |
||||
|
||||
.uniui-arrowright:before { |
||||
content: "\e6b5"; |
||||
} |
||||
|
||||
.uniui-top:before { |
||||
content: "\e6b6"; |
||||
} |
||||
|
||||
.uniui-arrowup:before { |
||||
content: "\e6b6"; |
||||
} |
||||
|
||||
.uniui-left:before { |
||||
content: "\e6b7"; |
||||
} |
||||
|
||||
.uniui-arrowleft:before { |
||||
content: "\e6b7"; |
||||
} |
||||
|
||||
.uniui-eye:before { |
||||
content: "\e651"; |
||||
} |
||||
|
||||
.uniui-eye-filled:before { |
||||
content: "\e66a"; |
||||
} |
||||
|
||||
.uniui-eye-slash:before { |
||||
content: "\e6b3"; |
||||
} |
||||
|
||||
.uniui-eye-slash-filled:before { |
||||
content: "\e6b4"; |
||||
} |
||||
|
||||
.uniui-info-filled:before { |
||||
content: "\e649"; |
||||
} |
||||
|
||||
.uniui-reload:before { |
||||
content: "\e6b2"; |
||||
} |
||||
|
||||
.uniui-micoff-filled:before { |
||||
content: "\e6b0"; |
||||
} |
||||
|
||||
.uniui-map-pin-ellipse:before { |
||||
content: "\e6ac"; |
||||
} |
||||
|
||||
.uniui-map-pin:before { |
||||
content: "\e6ad"; |
||||
} |
||||
|
||||
.uniui-location:before { |
||||
content: "\e6ae"; |
||||
} |
||||
|
||||
.uniui-starhalf:before { |
||||
content: "\e683"; |
||||
} |
||||
|
||||
.uniui-star:before { |
||||
content: "\e688"; |
||||
} |
||||
|
||||
.uniui-star-filled:before { |
||||
content: "\e68f"; |
||||
} |
||||
|
||||
.uniui-calendar:before { |
||||
content: "\e6a0"; |
||||
} |
||||
|
||||
.uniui-fire:before { |
||||
content: "\e6a1"; |
||||
} |
||||
|
||||
.uniui-medal:before { |
||||
content: "\e6a2"; |
||||
} |
||||
|
||||
.uniui-font:before { |
||||
content: "\e6a3"; |
||||
} |
||||
|
||||
.uniui-gift:before { |
||||
content: "\e6a4"; |
||||
} |
||||
|
||||
.uniui-link:before { |
||||
content: "\e6a5"; |
||||
} |
||||
|
||||
.uniui-notification:before { |
||||
content: "\e6a6"; |
||||
} |
||||
|
||||
.uniui-staff:before { |
||||
content: "\e6a7"; |
||||
} |
||||
|
||||
.uniui-vip:before { |
||||
content: "\e6a8"; |
||||
} |
||||
|
||||
.uniui-folder-add:before { |
||||
content: "\e6a9"; |
||||
} |
||||
|
||||
.uniui-tune:before { |
||||
content: "\e6aa"; |
||||
} |
||||
|
||||
.uniui-auth:before { |
||||
content: "\e6ab"; |
||||
} |
||||
|
||||
.uniui-person:before { |
||||
content: "\e699"; |
||||
} |
||||
|
||||
.uniui-email-filled:before { |
||||
content: "\e69a"; |
||||
} |
||||
|
||||
.uniui-phone-filled:before { |
||||
content: "\e69b"; |
||||
} |
||||
|
||||
.uniui-phone:before { |
||||
content: "\e69c"; |
||||
} |
||||
|
||||
.uniui-email:before { |
||||
content: "\e69e"; |
||||
} |
||||
|
||||
.uniui-personadd:before { |
||||
content: "\e69f"; |
||||
} |
||||
|
||||
.uniui-chatboxes-filled:before { |
||||
content: "\e692"; |
||||
} |
||||
|
||||
.uniui-contact:before { |
||||
content: "\e693"; |
||||
} |
||||
|
||||
.uniui-chatbubble-filled:before { |
||||
content: "\e694"; |
||||
} |
||||
|
||||
.uniui-contact-filled:before { |
||||
content: "\e695"; |
||||
} |
||||
|
||||
.uniui-chatboxes:before { |
||||
content: "\e696"; |
||||
} |
||||
|
||||
.uniui-chatbubble:before { |
||||
content: "\e697"; |
||||
} |
||||
|
||||
.uniui-upload-filled:before { |
||||
content: "\e68e"; |
||||
} |
||||
|
||||
.uniui-upload:before { |
||||
content: "\e690"; |
||||
} |
||||
|
||||
.uniui-weixin:before { |
||||
content: "\e691"; |
||||
} |
||||
|
||||
.uniui-compose:before { |
||||
content: "\e67f"; |
||||
} |
||||
|
||||
.uniui-qq:before { |
||||
content: "\e680"; |
||||
} |
||||
|
||||
.uniui-download-filled:before { |
||||
content: "\e681"; |
||||
} |
||||
|
||||
.uniui-pyq:before { |
||||
content: "\e682"; |
||||
} |
||||
|
||||
.uniui-sound:before { |
||||
content: "\e684"; |
||||
} |
||||
|
||||
.uniui-trash-filled:before { |
||||
content: "\e685"; |
||||
} |
||||
|
||||
.uniui-sound-filled:before { |
||||
content: "\e686"; |
||||
} |
||||
|
||||
.uniui-trash:before { |
||||
content: "\e687"; |
||||
} |
||||
|
||||
.uniui-videocam-filled:before { |
||||
content: "\e689"; |
||||
} |
||||
|
||||
.uniui-spinner-cycle:before { |
||||
content: "\e68a"; |
||||
} |
||||
|
||||
.uniui-weibo:before { |
||||
content: "\e68b"; |
||||
} |
||||
|
||||
.uniui-videocam:before { |
||||
content: "\e68c"; |
||||
} |
||||
|
||||
.uniui-download:before { |
||||
content: "\e68d"; |
||||
} |
||||
|
||||
.uniui-help:before { |
||||
content: "\e679"; |
||||
} |
||||
|
||||
.uniui-navigate-filled:before { |
||||
content: "\e67a"; |
||||
} |
||||
|
||||
.uniui-plusempty:before { |
||||
content: "\e67b"; |
||||
} |
||||
|
||||
.uniui-smallcircle:before { |
||||
content: "\e67c"; |
||||
} |
||||
|
||||
.uniui-minus-filled:before { |
||||
content: "\e67d"; |
||||
} |
||||
|
||||
.uniui-micoff:before { |
||||
content: "\e67e"; |
||||
} |
||||
|
||||
.uniui-closeempty:before { |
||||
content: "\e66c"; |
||||
} |
||||
|
||||
.uniui-clear:before { |
||||
content: "\e66d"; |
||||
} |
||||
|
||||
.uniui-navigate:before { |
||||
content: "\e66e"; |
||||
} |
||||
|
||||
.uniui-minus:before { |
||||
content: "\e66f"; |
||||
} |
||||
|
||||
.uniui-image:before { |
||||
content: "\e670"; |
||||
} |
||||
|
||||
.uniui-mic:before { |
||||
content: "\e671"; |
||||
} |
||||
|
||||
.uniui-paperplane:before { |
||||
content: "\e672"; |
||||
} |
||||
|
||||
.uniui-close:before { |
||||
content: "\e673"; |
||||
} |
||||
|
||||
.uniui-help-filled:before { |
||||
content: "\e674"; |
||||
} |
||||
|
||||
.uniui-paperplane-filled:before { |
||||
content: "\e675"; |
||||
} |
||||
|
||||
.uniui-plus:before { |
||||
content: "\e676"; |
||||
} |
||||
|
||||
.uniui-mic-filled:before { |
||||
content: "\e677"; |
||||
} |
||||
|
||||
.uniui-image-filled:before { |
||||
content: "\e678"; |
||||
} |
||||
|
||||
.uniui-locked-filled:before { |
||||
content: "\e668"; |
||||
} |
||||
|
||||
.uniui-info:before { |
||||
content: "\e669"; |
||||
} |
||||
|
||||
.uniui-locked:before { |
||||
content: "\e66b"; |
||||
} |
||||
|
||||
.uniui-camera-filled:before { |
||||
content: "\e658"; |
||||
} |
||||
|
||||
.uniui-chat-filled:before { |
||||
content: "\e659"; |
||||
} |
||||
|
||||
.uniui-camera:before { |
||||
content: "\e65a"; |
||||
} |
||||
|
||||
.uniui-circle:before { |
||||
content: "\e65b"; |
||||
} |
||||
|
||||
.uniui-checkmarkempty:before { |
||||
content: "\e65c"; |
||||
} |
||||
|
||||
.uniui-chat:before { |
||||
content: "\e65d"; |
||||
} |
||||
|
||||
.uniui-circle-filled:before { |
||||
content: "\e65e"; |
||||
} |
||||
|
||||
.uniui-flag:before { |
||||
content: "\e65f"; |
||||
} |
||||
|
||||
.uniui-flag-filled:before { |
||||
content: "\e660"; |
||||
} |
||||
|
||||
.uniui-gear-filled:before { |
||||
content: "\e661"; |
||||
} |
||||
|
||||
.uniui-home:before { |
||||
content: "\e662"; |
||||
} |
||||
|
||||
.uniui-home-filled:before { |
||||
content: "\e663"; |
||||
} |
||||
|
||||
.uniui-gear:before { |
||||
content: "\e664"; |
||||
} |
||||
|
||||
.uniui-smallcircle-filled:before { |
||||
content: "\e665"; |
||||
} |
||||
|
||||
.uniui-map-filled:before { |
||||
content: "\e666"; |
||||
} |
||||
|
||||
.uniui-map:before { |
||||
content: "\e667"; |
||||
} |
||||
|
||||
.uniui-refresh-filled:before { |
||||
content: "\e656"; |
||||
} |
||||
|
||||
.uniui-refresh:before { |
||||
content: "\e657"; |
||||
} |
||||
|
||||
.uniui-cloud-upload:before { |
||||
content: "\e645"; |
||||
} |
||||
|
||||
.uniui-cloud-download-filled:before { |
||||
content: "\e646"; |
||||
} |
||||
|
||||
.uniui-cloud-download:before { |
||||
content: "\e647"; |
||||
} |
||||
|
||||
.uniui-cloud-upload-filled:before { |
||||
content: "\e648"; |
||||
} |
||||
|
||||
.uniui-redo:before { |
||||
content: "\e64a"; |
||||
} |
||||
|
||||
.uniui-images-filled:before { |
||||
content: "\e64b"; |
||||
} |
||||
|
||||
.uniui-undo-filled:before { |
||||
content: "\e64c"; |
||||
} |
||||
|
||||
.uniui-more:before { |
||||
content: "\e64d"; |
||||
} |
||||
|
||||
.uniui-more-filled:before { |
||||
content: "\e64e"; |
||||
} |
||||
|
||||
.uniui-undo:before { |
||||
content: "\e64f"; |
||||
} |
||||
|
||||
.uniui-images:before { |
||||
content: "\e650"; |
||||
} |
||||
|
||||
.uniui-paperclip:before { |
||||
content: "\e652"; |
||||
} |
||||
|
||||
.uniui-settings:before { |
||||
content: "\e653"; |
||||
} |
||||
|
||||
.uniui-search:before { |
||||
content: "\e654"; |
||||
} |
||||
|
||||
.uniui-redo-filled:before { |
||||
content: "\e655"; |
||||
} |
||||
|
||||
.uniui-list:before { |
||||
content: "\e644"; |
||||
} |
||||
|
||||
.uniui-mail-open-filled:before { |
||||
content: "\e63a"; |
||||
} |
||||
|
||||
.uniui-hand-down-filled:before { |
||||
content: "\e63c"; |
||||
} |
||||
|
||||
.uniui-hand-down:before { |
||||
content: "\e63d"; |
||||
} |
||||
|
||||
.uniui-hand-up-filled:before { |
||||
content: "\e63e"; |
||||
} |
||||
|
||||
.uniui-hand-up:before { |
||||
content: "\e63f"; |
||||
} |
||||
|
||||
.uniui-heart-filled:before { |
||||
content: "\e641"; |
||||
} |
||||
|
||||
.uniui-mail-open:before { |
||||
content: "\e643"; |
||||
} |
||||
|
||||
.uniui-heart:before { |
||||
content: "\e639"; |
||||
} |
||||
|
||||
.uniui-loop:before { |
||||
content: "\e633"; |
||||
} |
||||
|
||||
.uniui-pulldown:before { |
||||
content: "\e632"; |
||||
} |
||||
|
||||
.uniui-scan:before { |
||||
content: "\e62a"; |
||||
} |
||||
|
||||
.uniui-bars:before { |
||||
content: "\e627"; |
||||
} |
||||
|
||||
.uniui-cart-filled:before { |
||||
content: "\e629"; |
||||
} |
||||
|
||||
.uniui-checkbox:before { |
||||
content: "\e62b"; |
||||
} |
||||
|
||||
.uniui-checkbox-filled:before { |
||||
content: "\e62c"; |
||||
} |
||||
|
||||
.uniui-shop:before { |
||||
content: "\e62f"; |
||||
} |
||||
|
||||
.uniui-headphones:before { |
||||
content: "\e630"; |
||||
} |
||||
|
||||
.uniui-cart:before { |
||||
content: "\e631"; |
||||
} |
Binary file not shown.
@ -1,86 +0,0 @@
|
||||
{ |
||||
"id": "uni-icons", |
||||
"displayName": "uni-icons 图标", |
||||
"version": "1.3.5", |
||||
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", |
||||
"keywords": [ |
||||
"uni-ui", |
||||
"uniui", |
||||
"icon", |
||||
"图标" |
||||
], |
||||
"repository": "https://github.com/dcloudio/uni-ui", |
||||
"engines": { |
||||
"HBuilderX": "^3.2.14" |
||||
}, |
||||
"directories": { |
||||
"example": "../../temps/example_temps" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"前端组件", |
||||
"通用组件" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "无", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": ["uni-scss"], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "y" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y" |
||||
}, |
||||
"快应用": { |
||||
"华为": "u", |
||||
"联盟": "u" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,8 +0,0 @@
|
||||
## Icons 图标 |
||||
> **组件名:uni-icons** |
||||
> 代码块: `uIcons` |
||||
|
||||
用于展示 icons 图标 。 |
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-icons) |
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
@ -1,19 +0,0 @@
|
||||
## 1.3.3(2022-01-20) |
||||
- 新增 showText属性 ,是否显示文本 |
||||
## 1.3.2(2022-01-19) |
||||
- 修复 nvue 平台下不显示文本的bug |
||||
## 1.3.1(2022-01-19) |
||||
- 修复 微信小程序平台样式选择器报警告的问题 |
||||
## 1.3.0(2021-11-19) |
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) |
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-load-more](https://uniapp.dcloud.io/component/uniui/uni-load-more) |
||||
## 1.2.1(2021-08-24) |
||||
- 新增 支持国际化 |
||||
## 1.2.0(2021-07-30) |
||||
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) |
||||
## 1.1.8(2021-05-12) |
||||
- 新增 组件示例地址 |
||||
## 1.1.7(2021-03-30) |
||||
- 修复 uni-load-more 在首页使用时,h5 平台报 'uni is not defined' 的 bug |
||||
## 1.1.6(2021-02-05) |
||||
- 调整为uni_modules目录规范 |
@ -1,5 +0,0 @@
|
||||
{ |
||||
"uni-load-more.contentdown": "Pull up to show more", |
||||
"uni-load-more.contentrefresh": "loading...", |
||||
"uni-load-more.contentnomore": "No more data" |
||||
} |
@ -1,8 +0,0 @@
|
||||
import en from './en.json' |
||||
import zhHans from './zh-Hans.json' |
||||
import zhHant from './zh-Hant.json' |
||||
export default { |
||||
en, |
||||
'zh-Hans': zhHans, |
||||
'zh-Hant': zhHant |
||||
} |
@ -1,5 +0,0 @@
|
||||
{ |
||||
"uni-load-more.contentdown": "上拉显示更多", |
||||
"uni-load-more.contentrefresh": "正在加载...", |
||||
"uni-load-more.contentnomore": "没有更多数据了" |
||||
} |
@ -1,5 +0,0 @@
|
||||
{ |
||||
"uni-load-more.contentdown": "上拉顯示更多", |
||||
"uni-load-more.contentrefresh": "正在加載...", |
||||
"uni-load-more.contentnomore": "沒有更多數據了" |
||||
} |
File diff suppressed because one or more lines are too long
@ -1,86 +0,0 @@
|
||||
{ |
||||
"id": "uni-load-more", |
||||
"displayName": "uni-load-more 加载更多", |
||||
"version": "1.3.3", |
||||
"description": "LoadMore 组件,常用在列表里面,做滚动加载使用。", |
||||
"keywords": [ |
||||
"uni-ui", |
||||
"uniui", |
||||
"加载更多", |
||||
"load-more" |
||||
], |
||||
"repository": "https://github.com/dcloudio/uni-ui", |
||||
"engines": { |
||||
"HBuilderX": "" |
||||
}, |
||||
"directories": { |
||||
"example": "../../temps/example_temps" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"前端组件", |
||||
"通用组件" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "无", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": ["uni-scss"], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "y" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y" |
||||
}, |
||||
"快应用": { |
||||
"华为": "u", |
||||
"联盟": "u" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,14 +0,0 @@
|
||||
|
||||
|
||||
### LoadMore 加载更多 |
||||
> **组件名:uni-load-more** |
||||
> 代码块: `uLoadMore` |
||||
|
||||
|
||||
用于列表中,做滚动加载使用,展示 loading 的各种状态。 |
||||
|
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-load-more) |
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
## 1.0.3(2022-01-21) |
||||
- 优化 组件示例 |
||||
## 1.0.2(2021-11-22) |
||||
- 修复 / 符号在 vue 不同版本兼容问题引起的报错问题 |
||||
## 1.0.1(2021-11-22) |
||||
- 修复 vue3中scss语法兼容问题 |
||||
## 1.0.0(2021-11-18) |
||||
- init |
@ -1,82 +0,0 @@
|
||||
{ |
||||
"id": "uni-scss", |
||||
"displayName": "uni-scss 辅助样式", |
||||
"version": "1.0.3", |
||||
"description": "uni-sass是uni-ui提供的一套全局样式 ,通过一些简单的类名和sass变量,实现简单的页面布局操作,比如颜色、边距、圆角等。", |
||||
"keywords": [ |
||||
"uni-scss", |
||||
"uni-ui", |
||||
"辅助样式" |
||||
], |
||||
"repository": "https://github.com/dcloudio/uni-ui", |
||||
"engines": { |
||||
"HBuilderX": "^3.1.0" |
||||
}, |
||||
"dcloudext": { |
||||
"category": [ |
||||
"JS SDK", |
||||
"通用 SDK" |
||||
], |
||||
"sale": { |
||||
"regular": { |
||||
"price": "0.00" |
||||
}, |
||||
"sourcecode": { |
||||
"price": "0.00" |
||||
} |
||||
}, |
||||
"contact": { |
||||
"qq": "" |
||||
}, |
||||
"declaration": { |
||||
"ads": "无", |
||||
"data": "无", |
||||
"permissions": "无" |
||||
}, |
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" |
||||
}, |
||||
"uni_modules": { |
||||
"dependencies": [], |
||||
"encrypt": [], |
||||
"platforms": { |
||||
"cloud": { |
||||
"tcb": "y", |
||||
"aliyun": "y" |
||||
}, |
||||
"client": { |
||||
"App": { |
||||
"app-vue": "y", |
||||
"app-nvue": "u" |
||||
}, |
||||
"H5-mobile": { |
||||
"Safari": "y", |
||||
"Android Browser": "y", |
||||
"微信浏览器(Android)": "y", |
||||
"QQ浏览器(Android)": "y" |
||||
}, |
||||
"H5-pc": { |
||||
"Chrome": "y", |
||||
"IE": "y", |
||||
"Edge": "y", |
||||
"Firefox": "y", |
||||
"Safari": "y" |
||||
}, |
||||
"小程序": { |
||||
"微信": "y", |
||||
"阿里": "y", |
||||
"百度": "y", |
||||
"字节跳动": "y", |
||||
"QQ": "y" |
||||
}, |
||||
"快应用": { |
||||
"华为": "n", |
||||
"联盟": "n" |
||||
}, |
||||
"Vue": { |
||||
"vue2": "y", |
||||
"vue3": "y" |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,4 +0,0 @@
|
||||
`uni-sass` 是 `uni-ui`提供的一套全局样式 ,通过一些简单的类名和`sass`变量,实现简单的页面布局操作,比如颜色、边距、圆角等。 |
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-sass) |
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839 |
@ -1,7 +0,0 @@
|
||||
@import './setting/_variables.scss'; |
||||
@import './setting/_border.scss'; |
||||
@import './setting/_color.scss'; |
||||
@import './setting/_space.scss'; |
||||
@import './setting/_radius.scss'; |
||||
@import './setting/_text.scss'; |
||||
@import './setting/_styles.scss'; |
@ -1,3 +0,0 @@
|
||||
.uni-border { |
||||
border: 1px $uni-border-1 solid; |
||||
} |
@ -1,66 +0,0 @@
|
||||
|
||||
// TODO 暂时不需要 class ,需要用户使用变量实现 ,如果使用类名其实并不推荐 |
||||
// @mixin get-styles($k,$c) { |
||||
// @if $k == size or $k == weight{ |
||||
// font-#{$k}:#{$c} |
||||
// }@else{ |
||||
// #{$k}:#{$c} |
||||
// } |
||||
// } |
||||
$uni-ui-color:( |
||||
// 主色 |
||||
primary: $uni-primary, |
||||
primary-disable: $uni-primary-disable, |
||||
primary-light: $uni-primary-light, |
||||
// 辅助色 |
||||
success: $uni-success, |
||||
success-disable: $uni-success-disable, |
||||
success-light: $uni-success-light, |
||||
warning: $uni-warning, |
||||
warning-disable: $uni-warning-disable, |
||||
warning-light: $uni-warning-light, |
||||
error: $uni-error, |
||||
error-disable: $uni-error-disable, |
||||
error-light: $uni-error-light, |
||||
info: $uni-info, |
||||
info-disable: $uni-info-disable, |
||||
info-light: $uni-info-light, |
||||
// 中性色 |
||||
main-color: $uni-main-color, |
||||
base-color: $uni-base-color, |
||||
secondary-color: $uni-secondary-color, |
||||
extra-color: $uni-extra-color, |
||||
// 背景色 |
||||
bg-color: $uni-bg-color, |
||||
// 边框颜色 |
||||
border-1: $uni-border-1, |
||||
border-2: $uni-border-2, |
||||
border-3: $uni-border-3, |
||||
border-4: $uni-border-4, |
||||
// 黑色 |
||||
black:$uni-black, |
||||
// 白色 |
||||
white:$uni-white, |
||||
// 透明 |
||||
transparent:$uni-transparent |
||||
) !default; |
||||
@each $key, $child in $uni-ui-color { |
||||
.uni-#{"" + $key} { |
||||
color: $child; |
||||
} |
||||
.uni-#{"" + $key}-bg { |
||||
background-color: $child; |
||||
} |
||||
} |
||||
.uni-shadow-sm { |
||||
box-shadow: $uni-shadow-sm; |
||||
} |
||||
.uni-shadow-base { |
||||
box-shadow: $uni-shadow-base; |
||||
} |
||||
.uni-shadow-lg { |
||||
box-shadow: $uni-shadow-lg; |
||||
} |
||||
.uni-mask { |
||||
background-color:$uni-mask; |
||||
} |
@ -1,55 +0,0 @@
|
||||
@mixin radius($r,$d:null ,$important: false){ |
||||
$radius-value:map-get($uni-radius, $r) if($important, !important, null); |
||||
// Key exists within the $uni-radius variable |
||||
@if (map-has-key($uni-radius, $r) and $d){ |
||||
@if $d == t { |
||||
border-top-left-radius:$radius-value; |
||||
border-top-right-radius:$radius-value; |
||||
}@else if $d == r { |
||||
border-top-right-radius:$radius-value; |
||||
border-bottom-right-radius:$radius-value; |
||||
}@else if $d == b { |
||||
border-bottom-left-radius:$radius-value; |
||||
border-bottom-right-radius:$radius-value; |
||||
}@else if $d == l { |
||||
border-top-left-radius:$radius-value; |
||||
border-bottom-left-radius:$radius-value; |
||||
}@else if $d == tl { |
||||
border-top-left-radius:$radius-value; |
||||
}@else if $d == tr { |
||||
border-top-right-radius:$radius-value; |
||||
}@else if $d == br { |
||||
border-bottom-right-radius:$radius-value; |
||||
}@else if $d == bl { |
||||
border-bottom-left-radius:$radius-value; |
||||
} |
||||
}@else{ |
||||
border-radius:$radius-value; |
||||
} |
||||
} |
||||
|
||||
@each $key, $child in $uni-radius { |
||||
@if($key){ |
||||
.uni-radius-#{"" + $key} { |
||||
@include radius($key) |
||||
} |
||||
}@else{ |
||||
.uni-radius { |
||||
@include radius($key) |
||||
} |
||||
} |
||||
} |
||||
|
||||
@each $direction in t, r, b, l,tl, tr, br, bl { |
||||
@each $key, $child in $uni-radius { |
||||
@if($key){ |
||||
.uni-radius-#{"" + $direction}-#{"" + $key} { |
||||
@include radius($key,$direction,false) |
||||
} |
||||
}@else{ |
||||
.uni-radius-#{$direction} { |
||||
@include radius($key,$direction,false) |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,56 +0,0 @@
|
||||
|
||||
@mixin fn($space,$direction,$size,$n) { |
||||
@if $n { |
||||
#{$space}-#{$direction}: #{$size*$uni-space-root}px |
||||
} @else { |
||||
#{$space}-#{$direction}: #{-$size*$uni-space-root}px |
||||
} |
||||
} |
||||
@mixin get-styles($direction,$i,$space,$n){ |
||||
@if $direction == t { |
||||
@include fn($space, top,$i,$n); |
||||
} |
||||
@if $direction == r { |
||||
@include fn($space, right,$i,$n); |
||||
} |
||||
@if $direction == b { |
||||
@include fn($space, bottom,$i,$n); |
||||
} |
||||
@if $direction == l { |
||||
@include fn($space, left,$i,$n); |
||||
} |
||||
@if $direction == x { |
||||
@include fn($space, left,$i,$n); |
||||
@include fn($space, right,$i,$n); |
||||
} |
||||
@if $direction == y { |
||||
@include fn($space, top,$i,$n); |
||||
@include fn($space, bottom,$i,$n); |
||||
} |
||||
@if $direction == a { |
||||
@if $n { |
||||
#{$space}:#{$i*$uni-space-root}px; |
||||
} @else { |
||||
#{$space}:#{-$i*$uni-space-root}px; |
||||
} |
||||
} |
||||
} |
||||
|
||||
@each $orientation in m,p { |
||||
$space: margin; |
||||
@if $orientation == m { |
||||
$space: margin; |
||||
} @else { |
||||
$space: padding; |
||||
} |
||||
@for $i from 0 through 16 { |
||||
@each $direction in t, r, b, l, x, y, a { |
||||
.uni-#{$orientation}#{$direction}-#{$i} { |
||||
@include get-styles($direction,$i,$space,true); |
||||
} |
||||
.uni-#{$orientation}#{$direction}-n#{$i} { |
||||
@include get-styles($direction,$i,$space,false); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,167 +0,0 @@
|
||||
/* #ifndef APP-NVUE */ |
||||
|
||||
$-color-white:#fff; |
||||
$-color-black:#000; |
||||
@mixin base-style($color) { |
||||
color: #fff; |
||||
background-color: $color; |
||||
border-color: mix($-color-black, $color, 8%); |
||||
&:not([hover-class]):active { |
||||
background: mix($-color-black, $color, 10%); |
||||
border-color: mix($-color-black, $color, 20%); |
||||
color: $-color-white; |
||||
outline: none; |
||||
} |
||||
} |
||||
@mixin is-color($color) { |
||||
@include base-style($color); |
||||
&[loading] { |
||||
@include base-style($color); |
||||
&::before { |
||||
margin-right:5px; |
||||
} |
||||
} |
||||
&[disabled] { |
||||
&, |
||||
&[loading], |
||||
&:not([hover-class]):active { |
||||
color: $-color-white; |
||||
border-color: mix(darken($color,10%), $-color-white); |
||||
background-color: mix($color, $-color-white); |
||||
} |
||||
} |
||||
|
||||
} |
||||
@mixin base-plain-style($color) { |
||||
color:$color; |
||||
background-color: mix($-color-white, $color, 90%); |
||||
border-color: mix($-color-white, $color, 70%); |
||||
&:not([hover-class]):active { |
||||
background: mix($-color-white, $color, 80%); |
||||
color: $color; |
||||
outline: none; |
||||
border-color: mix($-color-white, $color, 50%); |
||||
} |
||||
} |
||||
@mixin is-plain($color){ |
||||
&[plain] { |
||||
@include base-plain-style($color); |
||||
&[loading] { |
||||
@include base-plain-style($color); |
||||
&::before { |
||||
margin-right:5px; |
||||
} |
||||
} |
||||
&[disabled] { |
||||
&, |
||||
&:active { |
||||
color: mix($-color-white, $color, 40%); |
||||
background-color: mix($-color-white, $color, 90%); |
||||
border-color: mix($-color-white, $color, 80%); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
.uni-btn { |
||||
margin: 5px; |
||||
color: #393939; |
||||
border:1px solid #ccc; |
||||
font-size: 16px; |
||||
font-weight: 200; |
||||
background-color: #F9F9F9; |
||||
// TODO 暂时处理边框隐藏一边的问题 |
||||
overflow: visible; |
||||
&::after{ |
||||
border: none; |
||||
} |
||||
|
||||
&:not([type]),&[type=default] { |
||||
color: #999; |
||||
&[loading] { |
||||
background: none; |
||||
&::before { |
||||
margin-right:5px; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
&[disabled]{ |
||||
color: mix($-color-white, #999, 60%); |
||||
&, |
||||
&[loading], |
||||
&:active { |
||||
color: mix($-color-white, #999, 60%); |
||||
background-color: mix($-color-white,$-color-black , 98%); |
||||
border-color: mix($-color-white, #999, 85%); |
||||
} |
||||
} |
||||
|
||||
&[plain] { |
||||
color: #999; |
||||
background: none; |
||||
border-color: $uni-border-1; |
||||
&:not([hover-class]):active { |
||||
background: none; |
||||
color: mix($-color-white, $-color-black, 80%); |
||||
border-color: mix($-color-white, $-color-black, 90%); |
||||
outline: none; |
||||
} |
||||
&[disabled]{ |
||||
&, |
||||
&[loading], |
||||
&:active { |
||||
background: none; |
||||
color: mix($-color-white, #999, 60%); |
||||
border-color: mix($-color-white, #999, 85%); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
&:not([hover-class]):active { |
||||
color: mix($-color-white, $-color-black, 50%); |
||||
} |
||||
|
||||
&[size=mini] { |
||||
font-size: 16px; |
||||
font-weight: 200; |
||||
border-radius: 8px; |
||||
} |
||||
|
||||
|
||||
|
||||
&.uni-btn-small { |
||||
font-size: 14px; |
||||
} |
||||
&.uni-btn-mini { |
||||
font-size: 12px; |
||||
} |
||||
|
||||
&.uni-btn-radius { |
||||
border-radius: 999px; |
||||
} |
||||
&[type=primary] { |
||||
@include is-color($uni-primary); |
||||
@include is-plain($uni-primary) |
||||
} |
||||
&[type=success] { |
||||
@include is-color($uni-success); |
||||
@include is-plain($uni-success) |
||||
} |
||||
&[type=error] { |
||||
@include is-color($uni-error); |
||||
@include is-plain($uni-error) |
||||
} |
||||
&[type=warning] { |
||||
@include is-color($uni-warning); |
||||
@include is-plain($uni-warning) |
||||
} |
||||
&[type=info] { |
||||
@include is-color($uni-info); |
||||
@include is-plain($uni-info) |
||||
} |
||||
} |
||||
/* #endif */ |
@ -1,24 +0,0 @@
|
||||
@mixin get-styles($k,$c) { |
||||
@if $k == size or $k == weight{ |
||||
font-#{$k}:#{$c} |
||||
}@else{ |
||||
#{$k}:#{$c} |
||||
} |
||||
} |
||||
|
||||
@each $key, $child in $uni-headings { |
||||
/* #ifndef APP-NVUE */ |
||||
.uni-#{$key} { |
||||
@each $k, $c in $child { |
||||
@include get-styles($k,$c) |
||||
} |
||||
} |
||||
/* #endif */ |
||||
/* #ifdef APP-NVUE */ |
||||
.container .uni-#{$key} { |
||||
@each $k, $c in $child { |
||||
@include get-styles($k,$c) |
||||
} |
||||
} |
||||
/* #endif */ |
||||
} |
@ -1,146 +0,0 @@
|
||||
// @use "sass:math"; |
||||
@import '../tools/functions.scss'; |
||||
// 间距基础倍数 |
||||
$uni-space-root: 2 !default; |
||||
// 边框半径默认值 |
||||
$uni-radius-root:5px !default; |
||||
$uni-radius: () !default; |
||||
// 边框半径断点 |
||||
$uni-radius: map-deep-merge( |
||||
( |
||||
0: 0, |
||||
// TODO 当前版本暂时不支持 sm 属性 |
||||
// 'sm': math.div($uni-radius-root, 2), |
||||
null: $uni-radius-root, |
||||
'lg': $uni-radius-root * 2, |
||||
'xl': $uni-radius-root * 6, |
||||
'pill': 9999px, |
||||
'circle': 50% |
||||
), |
||||
$uni-radius |
||||
); |
||||
// 字体家族 |
||||
$body-font-family: 'Roboto', sans-serif !default; |
||||
// 文本 |
||||
$heading-font-family: $body-font-family !default; |
||||
$uni-headings: () !default; |
||||
$letterSpacing: -0.01562em; |
||||
$uni-headings: map-deep-merge( |
||||
( |
||||
'h1': ( |
||||
size: 32px, |
||||
weight: 300, |
||||
line-height: 50px, |
||||
// letter-spacing:-0.01562em |
||||
), |
||||
'h2': ( |
||||
size: 28px, |
||||
weight: 300, |
||||
line-height: 40px, |
||||
// letter-spacing: -0.00833em |
||||
), |
||||
'h3': ( |
||||
size: 24px, |
||||
weight: 400, |
||||
line-height: 32px, |
||||
// letter-spacing: normal |
||||
), |
||||
'h4': ( |
||||
size: 20px, |
||||
weight: 400, |
||||
line-height: 30px, |
||||
// letter-spacing: 0.00735em |
||||
), |
||||
'h5': ( |
||||
size: 16px, |
||||
weight: 400, |
||||
line-height: 24px, |
||||
// letter-spacing: normal |
||||
), |
||||
'h6': ( |
||||
size: 14px, |
||||
weight: 500, |
||||
line-height: 18px, |
||||
// letter-spacing: 0.0125em |
||||
), |
||||
'subtitle': ( |
||||
size: 12px, |
||||
weight: 400, |
||||
line-height: 20px, |
||||
// letter-spacing: 0.00937em |
||||
), |
||||
'body': ( |
||||
font-size: 14px, |
||||
font-weight: 400, |
||||
line-height: 22px, |
||||
// letter-spacing: 0.03125em |
||||
), |
||||
'caption': ( |
||||
'size': 12px, |
||||
'weight': 400, |
||||
'line-height': 20px, |
||||
// 'letter-spacing': 0.03333em, |
||||
// 'text-transform': false |
||||
) |
||||
), |
||||
$uni-headings |
||||
); |
||||
|
||||
|
||||
|
||||
// 主色 |
||||
$uni-primary: #2979ff !default; |
||||
$uni-primary-disable:lighten($uni-primary,20%) !default; |
||||
$uni-primary-light: lighten($uni-primary,25%) !default; |
||||
|
||||
// 辅助色 |
||||
// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 |
||||
$uni-success: #18bc37 !default; |
||||
$uni-success-disable:lighten($uni-success,20%) !default; |
||||
$uni-success-light: lighten($uni-success,25%) !default; |
||||
|
||||
$uni-warning: #f3a73f !default; |
||||
$uni-warning-disable:lighten($uni-warning,20%) !default; |
||||
$uni-warning-light: lighten($uni-warning,25%) !default; |
||||
|
||||
$uni-error: #e43d33 !default; |
||||
$uni-error-disable:lighten($uni-error,20%) !default; |
||||
$uni-error-light: lighten($uni-error,25%) !default; |
||||
|
||||
$uni-info: #8f939c !default; |
||||
$uni-info-disable:lighten($uni-info,20%) !default; |
||||
$uni-info-light: lighten($uni-info,25%) !default; |
||||
|
||||
// 中性色 |
||||
// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 |
||||
$uni-main-color: #3a3a3a !default; // 主要文字 |
||||
$uni-base-color: #6a6a6a !default; // 常规文字 |
||||
$uni-secondary-color: #909399 !default; // 次要文字 |
||||
$uni-extra-color: #c7c7c7 !default; // 辅助说明 |
||||
|
||||
// 边框颜色 |
||||
$uni-border-1: #F0F0F0 !default; |
||||
$uni-border-2: #EDEDED !default; |
||||
$uni-border-3: #DCDCDC !default; |
||||
$uni-border-4: #B9B9B9 !default; |
||||
|
||||
// 常规色 |
||||
$uni-black: #000000 !default; |
||||
$uni-white: #ffffff !default; |
||||
$uni-transparent: rgba($color: #000000, $alpha: 0) !default; |
||||
|
||||
// 背景色 |
||||
$uni-bg-color: #f7f7f7 !default; |
||||
|
||||
/* 水平间距 */ |
||||
$uni-spacing-sm: 8px !default; |
||||
$uni-spacing-base: 15px !default; |
||||
$uni-spacing-lg: 30px !default; |
||||
|
||||
// 阴影 |
||||
$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5) !default; |
||||
$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2) !default; |
||||
$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5) !default; |
||||
|
||||
// 蒙版 |
||||
$uni-mask: rgba($color: #000000, $alpha: 0.4) !default; |
@ -1,19 +0,0 @@
|
||||
// 合并 map |
||||
@function map-deep-merge($parent-map, $child-map){ |
||||
$result: $parent-map; |
||||
@each $key, $child in $child-map { |
||||
$parent-has-key: map-has-key($result, $key); |
||||
$parent-value: map-get($result, $key); |
||||
$parent-type: type-of($parent-value); |
||||
$child-type: type-of($child); |
||||
$parent-is-map: $parent-type == map; |
||||
$child-is-map: $child-type == map; |
||||
|
||||
@if (not $parent-has-key) or ($parent-type != $child-type) or (not ($parent-is-map and $child-is-map)){ |
||||
$result: map-merge($result, ( $key: $child )); |
||||
}@else { |
||||
$result: map-merge($result, ( $key: map-deep-merge($parent-value, $child) )); |
||||
} |
||||
} |
||||
@return $result; |
||||
}; |
@ -1,31 +0,0 @@
|
||||
// 间距基础倍数 |
||||
$uni-space-root: 2; |
||||
// 边框半径默认值 |
||||
$uni-radius-root:5px; |
||||
// 主色 |
||||
$uni-primary: #2979ff; |
||||
// 辅助色 |
||||
$uni-success: #4cd964; |
||||
// 警告色 |
||||
$uni-warning: #f0ad4e; |
||||
// 错误色 |
||||
$uni-error: #dd524d; |
||||
// 描述色 |
||||
$uni-info: #909399; |
||||
// 中性色 |
||||
$uni-main-color: #303133; |
||||
$uni-base-color: #606266; |
||||
$uni-secondary-color: #909399; |
||||
$uni-extra-color: #C0C4CC; |
||||
// 背景色 |
||||
$uni-bg-color: #f5f5f5; |
||||
// 边框颜色 |
||||
$uni-border-1: #DCDFE6; |
||||
$uni-border-2: #E4E7ED; |
||||
$uni-border-3: #EBEEF5; |
||||
$uni-border-4: #F2F6FC; |
||||
|
||||
// 常规色 |
||||
$uni-black: #000000; |
||||
$uni-white: #ffffff; |
||||
$uni-transparent: rgba($color: #000000, $alpha: 0); |
@ -1,62 +0,0 @@
|
||||
@import './styles/setting/_variables.scss'; |
||||
// 间距基础倍数 |
||||
$uni-space-root: 2; |
||||
// 边框半径默认值 |
||||
$uni-radius-root:5px; |
||||
|
||||
// 主色 |
||||
$uni-primary: #2979ff; |
||||
$uni-primary-disable:mix(#fff,$uni-primary,50%); |
||||
$uni-primary-light: mix(#fff,$uni-primary,80%); |
||||
|
||||
// 辅助色 |
||||
// 除了主色外的场景色,需要在不同的场景中使用(例如危险色表示危险的操作)。 |
||||
$uni-success: #18bc37; |
||||
$uni-success-disable:mix(#fff,$uni-success,50%); |
||||
$uni-success-light: mix(#fff,$uni-success,80%); |
||||
|
||||
$uni-warning: #f3a73f; |
||||
$uni-warning-disable:mix(#fff,$uni-warning,50%); |
||||
$uni-warning-light: mix(#fff,$uni-warning,80%); |
||||
|
||||
$uni-error: #e43d33; |
||||
$uni-error-disable:mix(#fff,$uni-error,50%); |
||||
$uni-error-light: mix(#fff,$uni-error,80%); |
||||
|
||||
$uni-info: #8f939c; |
||||
$uni-info-disable:mix(#fff,$uni-info,50%); |
||||
$uni-info-light: mix(#fff,$uni-info,80%); |
||||
|
||||
// 中性色 |
||||
// 中性色用于文本、背景和边框颜色。通过运用不同的中性色,来表现层次结构。 |
||||
$uni-main-color: #3a3a3a; // 主要文字 |
||||
$uni-base-color: #6a6a6a; // 常规文字 |
||||
$uni-secondary-color: #909399; // 次要文字 |
||||
$uni-extra-color: #c7c7c7; // 辅助说明 |
||||
|
||||
// 边框颜色 |
||||
$uni-border-1: #F0F0F0; |
||||
$uni-border-2: #EDEDED; |
||||
$uni-border-3: #DCDCDC; |
||||
$uni-border-4: #B9B9B9; |
||||
|
||||
// 常规色 |
||||
$uni-black: #000000; |
||||
$uni-white: #ffffff; |
||||
$uni-transparent: rgba($color: #000000, $alpha: 0); |
||||
|
||||
// 背景色 |
||||
$uni-bg-color: #f7f7f7; |
||||
|
||||
/* 水平间距 */ |
||||
$uni-spacing-sm: 8px; |
||||
$uni-spacing-base: 15px; |
||||
$uni-spacing-lg: 30px; |
||||
|
||||
// 阴影 |
||||
$uni-shadow-sm:0 0 5px rgba($color: #d8d8d8, $alpha: 0.5); |
||||
$uni-shadow-base:0 1px 8px 1px rgba($color: #a5a5a5, $alpha: 0.2); |
||||
$uni-shadow-lg:0px 1px 10px 2px rgba($color: #a5a4a4, $alpha: 0.5); |
||||
|
||||
// 蒙版 |
||||
$uni-mask: rgba($color: #000000, $alpha: 0.4); |
@ -1,21 +0,0 @@
|
||||
MIT License |
||||
|
||||
Copyright (c) 2020 www.uviewui.com |
||||
|
||||
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. |
@ -1,66 +0,0 @@
|
||||
<p align="center"> |
||||
<img alt="logo" src="https://uviewui.com/common/logo.png" width="120" height="120" style="margin-bottom: 10px;"> |
||||
</p> |
||||
<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView 2.0</h3> |
||||
<h3 align="center">多平台快速开发的UI框架</h3> |
||||
|
||||
[![stars](https://img.shields.io/github/stars/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0) |
||||
[![forks](https://img.shields.io/github/forks/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0) |
||||
[![issues](https://img.shields.io/github/issues/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0/issues) |
||||
[![Website](https://img.shields.io/badge/uView-up-blue?style=flat-square)](https://uviewui.com) |
||||
[![release](https://img.shields.io/github/v/release/umicro/uView2.0?style=flat-square)](https://gitee.com/umicro/uView2.0/releases) |
||||
[![license](https://img.shields.io/github/license/umicro/uView2.0?style=flat-square)](https://en.wikipedia.org/wiki/MIT_License) |
||||
|
||||
## 说明 |
||||
|
||||
uView UI,是[uni-app](https://uniapp.dcloud.io/)全面兼容nvue的uni-app生态框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水 |
||||
|
||||
## [官方文档:https://uviewui.com](https://uviewui.com) |
||||
|
||||
|
||||
## 预览 |
||||
|
||||
您可以通过**微信**扫码,查看最佳的演示效果。 |
||||
<br> |
||||
<br> |
||||
<img src="https://uviewui.com/common/weixin_mini_qrcode.png" width="220" height="220" > |
||||
|
||||
|
||||
## 链接 |
||||
|
||||
- [官方文档](https://www.uviewui.com/) |
||||
- [更新日志](https://www.uviewui.com/components/changelog.html) |
||||
- [升级指南](https://www.uviewui.com/components/changeGuide.html) |
||||
- [关于我们](https://www.uviewui.com/cooperation/about.html) |
||||
|
||||
## 交流反馈 |
||||
|
||||
欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html) |
||||
|
||||
## 关于PR |
||||
|
||||
> 我们非常乐意接受各位的优质PR,但在此之前我希望您了解uView2.0是一个需要兼容多个平台的(小程序、h5、ios app、android app)包括nvue页面、vue页面。 |
||||
> 所以希望在您修复bug并提交之前尽可能的去这些平台测试一下兼容性。最好能携带测试截图以方便审核。非常感谢! |
||||
|
||||
## 安装 |
||||
|
||||
#### **uni-app插件市场链接** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593) |
||||
|
||||
请通过[官网安装文档](https://www.uviewui.com/components/install.html)了解更详细的内容 |
||||
|
||||
## 快速上手 |
||||
|
||||
请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容 |
||||
|
||||
## 使用方法 |
||||
配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。 |
||||
|
||||
```html |
||||
<template> |
||||
<u-button text="按钮"></u-button> |
||||
</template> |
||||
``` |
||||
|
||||
## 版权信息 |
||||
uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。 |
||||
|
@ -1,344 +0,0 @@
|
||||
## 2.0.33(2022-06-17) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复`loadmore`组件`lineColor`类型错误问题 |
||||
2. 修复`u-parse`组件`imgtap`、`linktap`不生效问题 |
||||
## 2.0.32(2022-06-16) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
1. `u-loadmore`新增自定义颜色、虚/实线 |
||||
2. 修复`u-swiper-action`组件部分平台不能上下滑动的问题 |
||||
3. 修复`u-list`回弹问题 |
||||
4. 修复`notice-bar`组件动画在低端安卓机可能会抖动的问题 |
||||
5. `u-loading-page`添加控制图标大小的属性`iconSize` |
||||
6. 修复`u-tooltip`组件`color`参数不生效的问题 |
||||
7. 修复`u--input`组件使用`blur`事件输出为`undefined`的bug |
||||
8. `u-code-input`组件新增键盘弹起时,是否自动上推页面参数`adjustPosition` |
||||
9. 修复`image`组件`load`事件无回调对象问题 |
||||
10. 修复`button`组件`loadingSize`设置无效问题 |
||||
10. 其他修复 |
||||
## 2.0.31(2022-04-19) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复`upload`在`vue`页面上传成功后没有成功标志的问题 |
||||
2. 解决演示项目中微信小程序模拟上传图片一直出于上传中问题 |
||||
3. 修复`u-code-input`组件在`nvue`页面编译到`app`平台上光标异常问题(`app`去除此功能) |
||||
4. 修复`actionSheet`组件标题关闭按钮点击事件名称错误的问题 |
||||
5. 其他修复 |
||||
## 2.0.30(2022-04-04) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. `u-rate`增加`readonly`属性 |
||||
2. `tabs`滑块支持设置背景图片 |
||||
3. 修复`u-subsection` `mode`为`subsection`时,滑块样式不正确的问题 |
||||
4. `u-code-input`添加光标效果动画 |
||||
5. 修复`popup`的`open`事件不触发 |
||||
6. 修复`u-flex-column`无效的问题 |
||||
7. 修复`u-datetime-picker`索引在特定场合异常问题 |
||||
8. 修复`u-datetime-picker`最小时间字符串模板错误问题 |
||||
9. `u-swiper`添加`m3u8`验证 |
||||
10. `u-swiper`修改判断image和video逻辑 |
||||
11. 修复`swiper`无法使用本地图片问题,增加`type`参数 |
||||
12. 修复`u-row-notice`格式错误问题 |
||||
13. 修复`u-switch`组件当`unit`为`rpx`时,`nodeStyle`消失的问题 |
||||
14. 修复`datetime-picker`组件`showToolbar`与`visibleItemCount`属性无效的问题 |
||||
15. 修复`upload`组件条件编译位置判断错误,导致`previewImage`属性设置为`false`时,整个组件都会被隐藏的问题 |
||||
16. 修复`u-checkbox-group`设置`shape`属性无效的问题 |
||||
17. 修复`u-upload`的`capture`传入字符串的时候不生效的问题 |
||||
18. 修复`u-action-sheet`组件,关闭事件逻辑错误的问题 |
||||
19. 修复`u-list`触顶事件的触发错误的问题 |
||||
20. 修复`u-text`只有手机号可拨打的问题 |
||||
21. 修复`u-textarea`不能换行的问题 |
||||
22. 其他修复 |
||||
## 2.0.29(2022-03-13) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复`u--text`组件设置`decoration`属性未生效的问题 |
||||
2. 修复`u-datetime-picker`使用`formatter`后返回值不正确 |
||||
3. 修复`u-datetime-picker` `intercept` 可能为undefined |
||||
4. 修复已设置单位 uni..config.unit = 'rpx'时,线型指示器 `transform` 的位置翻倍,导致指示器超出宽度 |
||||
5. 修复mixin中bem方法生成的类名在支付宝和字节小程序中失效 |
||||
6. 修复默认值传值为空的时候,打开`u-datetime-picker`报错,不能选中第一列时间的bug |
||||
7. 修复`u-datetime-picker`使用`formatter`后返回值不正确 |
||||
8. 修复`u-image`组件`loading`无效果的问题 |
||||
9. 修复`config.unit`属性设为`rpx`时,导航栏占用高度不足导致塌陷的问题 |
||||
10. 修复`u-datetime-picker`组件`itemHeight`无效问题 |
||||
11. 其他修复 |
||||
## 2.0.28(2022-02-22) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. search组件新增searchIconSize属性 |
||||
2. 兼容Safari/Webkit中传入时间格式如2022-02-17 12:00:56 |
||||
3. 修复text value.js 判断日期出format错误问题 |
||||
4. priceFormat格式化金额出现精度错误 |
||||
5. priceFormat在部分情况下出现精度损失问题 |
||||
6. 优化表单rules提示 |
||||
7. 修复avatar组件src为空时,展示状态不对 |
||||
8. 其他修复 |
||||
## 2.0.27(2022-01-28) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1.样式修复 |
||||
## 2.0.26(2022-01-28) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1.样式修复 |
||||
## 2.0.25(2022-01-27) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复text组件mode=price时,可能会导致精度错误的问题 |
||||
2. 添加$u.setConfig()方法,可设置uView内置的config, props, zIndex, color属性,详见:[修改uView内置配置方案](https://uviewui.com/components/setting.html#%E9%BB%98%E8%AE%A4%E5%8D%95%E4%BD%8D%E9%85%8D%E7%BD%AE) |
||||
3. 优化form组件在errorType=toast时,如果输入错误页面会有抖动的问题 |
||||
4. 修复$u.addUnit()对配置默认单位可能无效的问题 |
||||
## 2.0.24(2022-01-25) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复swiper在current指定非0时缩放有误 |
||||
2. 修复u-icon添加stop属性的时候报错 |
||||
3. 优化遗留的通过正则判断rpx单位的问题 |
||||
4. 优化Layout布局 vue使用gutter时,会超出固定区域 |
||||
5. 优化search组件高度单位问题(rpx -> px) |
||||
6. 修复u-image slot 加载和错误的图片失去了高度 |
||||
7. 修复u-index-list中footer插槽与header插槽存在性判断错误 |
||||
8. 修复部分机型下u-popup关闭时会闪烁 |
||||
9. 修复u-image在nvue-app下失去宽高 |
||||
10. 修复u-popup运行报错 |
||||
11. 修复u-tooltip报错 |
||||
12. 修复box-sizing在app下的警告 |
||||
13. 修复u-navbar在小程序中报运行时错误 |
||||
14. 其他修复 |
||||
## 2.0.23(2022-01-24) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复image组件在hx3.3.9的nvue下可能会显示异常的问题 |
||||
2. 修复col组件gutter参数带rpx单位处理不正确的问题 |
||||
3. 修复text组件单行时无法显示省略号的问题 |
||||
4. navbar添加titleStyle参数 |
||||
5. 升级到hx3.3.9可消除nvue下控制台样式警告的问题 |
||||
## 2.0.22(2022-01-19) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. $u.page()方法优化,避免在特殊场景可能报错的问题 |
||||
2. picker组件添加immediateChange参数 |
||||
3. 新增$u.pages()方法 |
||||
## 2.0.21(2022-01-19) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 优化:form组件在用户设置rules的时候提示用户model必传 |
||||
2. 优化遗留的通过正则判断rpx单位的问题 |
||||
3. 修复微信小程序环境中tabbar组件开启safeAreaInsetBottom属性后,placeholder高度填充不正确 |
||||
4. 修复swiper在current指定非0时缩放有误 |
||||
5. 修复u-icon添加stop属性的时候报错 |
||||
6. 修复upload组件在accept=all的时候没有作用 |
||||
7. 修复在text组件mode为phone时call属性无效的问题 |
||||
8. 处理u-form clearValidate方法 |
||||
9. 其他修复 |
||||
## 2.0.20(2022-01-14) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复calendar默认会选择一个日期,如果直接点确定的话,无法取到值的问题 |
||||
2. 修复Slider缺少disabled props 还有注释 |
||||
3. 修复u-notice-bar点击事件无法拿到index索引值的问题 |
||||
4. 修复u-collapse-item在vue文件下,app端自定义插槽不生效的问题 |
||||
5. 优化头像为空时显示默认头像 |
||||
6. 修复图片地址赋值后判断加载状态为完成问题 |
||||
7. 修复日历滚动到默认日期月份区域 |
||||
8. search组件暴露点击左边icon事件 |
||||
9. 修复u-form clearValidate方法不生效 |
||||
10. upload h5端增加返回文件参数(文件的name参数) |
||||
11. 处理upload选择文件后url为blob类型无法预览的问题 |
||||
12. u-code-input 修复输入框没有往左移出一半屏幕 |
||||
13. 修复Upload上传 disabled为true时,控制台报hoverClass类型错误 |
||||
14. 临时处理ios app下grid点击坍塌问题 |
||||
15. 其他修复 |
||||
## 2.0.19(2021-12-29) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 优化微信小程序包体积可在微信中预览,请升级HbuilderX3.3.4,同时在“运行->运行到小程序模拟器”中勾选“运行时是否压缩代码” |
||||
2. 优化微信小程序setData性能,处理某些方法如$u.route()无法在模板中使用的问题 |
||||
3. navbar添加autoBack参数 |
||||
4. 允许avatar组件的事件冒泡 |
||||
5. 修复cell组件报错问题 |
||||
6. 其他修复 |
||||
## 2.0.18(2021-12-28) |
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复app端编译报错问题 |
||||
2. 重新处理微信小程序端setData过大的性能问题 |
||||
3. 修复边框问题 |
||||
4. 修复最大最小月份不大于0则没有数据出现的问题 |
||||
5. 修复SwipeAction微信小程序端无法上下滑动问题 |
||||
6. 修复input的placeholder在小程序端默认显示为true问题 |
||||
7. 修复divider组件click事件无效问题 |
||||
8. 修复u-code-input maxlength 属性值为 String 类型时显示异常 |
||||
9. 修复当 grid只有 1到2时 在小程序端algin设置无效的问题 |
||||
10. 处理form-item的label为top时,取消错误提示的左边距 |
||||
11. 其他修复 |
||||
## 2.0.17(2021-12-26) |
||||
## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 解决HBuilderX3.3.3.20211225版本导致的样式问题 |
||||
2. calendar日历添加monthNum参数 |
||||
3. navbar添加center slot |
||||
## 2.0.16(2021-12-25) |
||||
## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 解决微信小程序setData性能问题 |
||||
2. 修复count-down组件change事件不触发问题 |
||||
## 2.0.15(2021-12-21) |
||||
## uView正在参与开源中国的“年度最佳项目”评选,之前投过票的现在也可以投票,恳请同学们投一票,[点此帮助uView](https://www.oschina.net/project/top_cn_2021/?id=583) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复Cell单元格titleWidth无效 |
||||
2. 修复cheakbox组件ischecked不更新 |
||||
3. 修复keyboard是否显示"."按键默认值问题 |
||||
4. 修复number-keyboard是否显示键盘的"."符号问题 |
||||
5. 修复Input输入框 readonly无效 |
||||
6. 修复u-avatar 导致打包app、H5时候报错问题 |
||||
7. 修复Upload上传deletable无效 |
||||
8. 修复upload当设置maxSize时无效的问题 |
||||
9. 修复tabs lineWidth传入带单位的字符串的时候偏移量计算错误问题 |
||||
10. 修复rate组件在有padding的view内,显示的星星位置和可触摸区域不匹配,无法正常选中星星 |
||||
## 2.0.13(2021-12-14) |
||||
## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复配置默认单位为rpx可能会导致自定义导航栏高度异常的问题 |
||||
## 2.0.12(2021-12-14) |
||||
## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复tabs组件在vue环境下划线消失的问题 |
||||
2. 修复upload组件在安卓小程序无法选择视频的问题 |
||||
3. 添加uni.$u.config.unit配置,用于配置参数默认单位,详见:[默认单位配置](https://www.uviewui.com/components/setting.html#%E9%BB%98%E8%AE%A4%E5%8D%95%E4%BD%8D%E9%85%8D%E7%BD%AE) |
||||
4. 修复textarea组件在没绑定v-model时,字符统计不生效问题 |
||||
5. 修复nvue下控制是否出现滚动条失效问题 |
||||
## 2.0.11(2021-12-13) |
||||
## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. text组件align参数无效的问题 |
||||
2. subsection组件添加keyName参数 |
||||
3. upload组件无法判断[Object file]类型的问题 |
||||
4. 处理notify层级过低问题 |
||||
5. codeInput组件添加disabledDot参数 |
||||
6. 处理actionSheet组件round参数无效的问题 |
||||
7. calendar组件添加round参数用于控制圆角值 |
||||
8. 处理swipeAction组件在vue环境下默认被打开的问题 |
||||
9. button组件的throttleTime节流参数无效的问题 |
||||
10. 解决u-notify手动关闭方法close()无效的问题 |
||||
11. input组件readonly不生效问题 |
||||
12. tag组件type参数为info不生效问题 |
||||
## 2.0.10(2021-12-08) |
||||
## [点击加群交流反馈:364463526](https://jq.qq.com/?_chanwv=1027&k=mCxS3TGY) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复button sendMessagePath属性不生效 |
||||
2. 修复DatetimePicker选择器title无效 |
||||
3. 修复u-toast设置loading=true不生效 |
||||
4. 修复u-text金额模式传0报错 |
||||
5. 修复u-toast组件的icon属性配置不生效 |
||||
6. button的icon在特殊场景下的颜色优化 |
||||
7. IndexList优化,增加# |
||||
## 2.0.9(2021-12-01) |
||||
## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 优化swiper的height支持100%值(仅vue有效),修复嵌入视频时click事件无法触发的问题 |
||||
2. 优化tabs组件对list值为空的判断,或者动态变化list时重新计算相关尺寸的问题 |
||||
3. 优化datetime-picker组件逻辑,让其后续打开的默认值为上一次的选中值,需要通过v-model绑定值才有效 |
||||
4. 修复upload内嵌在其他组件中,选择图片可能不会换行的问题 |
||||
## 2.0.8(2021-12-01) |
||||
## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复toast的position参数无效问题 |
||||
2. 处理input在ios nvue上无法获得焦点的问题 |
||||
3. avatar-group组件添加extraValue参数,让剩余展示数量可手动控制 |
||||
4. tabs组件添加keyName参数用于配置从对象中读取的键名 |
||||
5. 处理text组件名字脱敏默认配置无效的问题 |
||||
6. 处理picker组件item文本太长换行问题 |
||||
## 2.0.7(2021-11-30) |
||||
## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 修复radio和checkbox动态改变v-model无效的问题。 |
||||
2. 优化form规则validator在微信小程序用法 |
||||
3. 修复backtop组件mode参数在微信小程序无效的问题 |
||||
4. 处理Album的previewFullImage属性无效的问题 |
||||
5. 处理u-datetime-picker组件mode='time'在选择改变时间时,控制台报错的问题 |
||||
## 2.0.6(2021-11-27) |
||||
## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. 处理tag组件在vue下边框无效的问题。 |
||||
2. 处理popup组件圆角参数可能无效的问题。 |
||||
3. 处理tabs组件lineColor参数可能无效的问题。 |
||||
4. propgress组件在值很小时,显示异常的问题。 |
||||
## 2.0.5(2021-11-25) |
||||
## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. calendar在vue下显示异常问题。 |
||||
2. form组件labelPosition和errorType参数无效的问题 |
||||
3. input组件inputAlign无效的问题 |
||||
4. 其他一些修复 |
||||
## 2.0.4(2021-11-23) |
||||
## [点击加群交流反馈:232041042](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
0. input组件缺失@confirm事件,以及subfix和prefix无效问题 |
||||
1. component.scss文件样式在vue下干扰全局布局问题 |
||||
2. 修复subsection在vue环境下表现异常的问题 |
||||
3. tag组件的bgColor等参数无效的问题 |
||||
4. upload组件不换行的问题 |
||||
5. 其他的一些修复处理 |
||||
## 2.0.3(2021-11-16) |
||||
## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. uView2.0已实现全面兼容nvue |
||||
2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 |
||||
3. 目前uView2.0为公测阶段,相关细节可能会有变动 |
||||
4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) |
||||
5. 处理modal的confirm回调事件拼写错误问题 |
||||
6. 处理input组件@input事件参数错误问题 |
||||
7. 其他一些修复 |
||||
## 2.0.2(2021-11-16) |
||||
## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. uView2.0已实现全面兼容nvue |
||||
2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 |
||||
3. 目前uView2.0为公测阶段,相关细节可能会有变动 |
||||
4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) |
||||
5. 修复input组件formatter参数缺失问题 |
||||
6. 优化loading-icon组件的scss写法问题,防止不兼容新版本scss |
||||
## 2.0.0(2020-11-15) |
||||
## [点击加群交流反馈:1129077272](https://jq.qq.com/?_wv=1027&k=KnbeceDU) |
||||
|
||||
# uView2.0重磅发布,利剑出鞘,一统江湖 |
||||
|
||||
1. uView2.0已实现全面兼容nvue |
||||
2. uView2.0对1.x进行了架构重构,细节和性能都有极大提升 |
||||
3. 目前uView2.0为公测阶段,相关细节可能会有变动 |
||||
4. 我们写了一份与1.x的对比指南,详见[对比1.x](https://www.uviewui.com/components/diff1.x.html) |
||||
5. 修复input组件formatter参数缺失问题 |
||||
|
||||
|
@ -1,78 +0,0 @@
|
||||
<template> |
||||
<uvForm |
||||
ref="uForm" |
||||
:model="model" |
||||
:rules="rules" |
||||
:errorType="errorType" |
||||
:borderBottom="borderBottom" |
||||
:labelPosition="labelPosition" |
||||
:labelWidth="labelWidth" |
||||
:labelAlign="labelAlign" |
||||
:labelStyle="labelStyle" |
||||
:customStyle="customStyle" |
||||
> |
||||
<slot /> |
||||
</uvForm> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* 此组件存在的理由是,在nvue下,u-form被uni-app官方占用了,u-form在nvue中相当于form组件 |
||||
* 所以在nvue下,取名为u--form,内部其实还是u-form.vue,只不过做一层中转 |
||||
*/ |
||||
import uvForm from '../u-form/u-form.vue'; |
||||
import props from '../u-form/props.js' |
||||
export default { |
||||
// #ifdef MP-WEIXIN |
||||
name: 'u-form', |
||||
// #endif |
||||
// #ifndef MP-WEIXIN |
||||
name: 'u--form', |
||||
// #endif |
||||
mixins: [uni.$u.mpMixin, props, uni.$u.mixin], |
||||
components: { |
||||
uvForm |
||||
}, |
||||
created() { |
||||
this.children = [] |
||||
}, |
||||
methods: { |
||||
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则 |
||||
setRules(rules) { |
||||
this.$refs.uForm.setRules(rules) |
||||
}, |
||||
validate() { |
||||
/** |
||||
* 在微信小程序中,通过this.$parent拿到的父组件是u--form,而不是其内嵌的u-form |
||||
* 导致在u-form组件中,拿不到对应的children数组,从而校验无效,所以这里每次调用u-form组件中的 |
||||
* 对应方法的时候,在小程序中都先将u--form的children赋值给u-form中的children |
||||
*/ |
||||
// #ifdef MP-WEIXIN |
||||
this.setMpData() |
||||
// #endif |
||||
return this.$refs.uForm.validate() |
||||
}, |
||||
validateField(value, callback) { |
||||
// #ifdef MP-WEIXIN |
||||
this.setMpData() |
||||
// #endif |
||||
return this.$refs.uForm.validateField(value, callback) |
||||
}, |
||||
resetFields() { |
||||
// #ifdef MP-WEIXIN |
||||
this.setMpData() |
||||
// #endif |
||||
return this.$refs.uForm.resetFields() |
||||
}, |
||||
clearValidate(props) { |
||||
// #ifdef MP-WEIXIN |
||||
this.setMpData() |
||||
// #endif |
||||
return this.$refs.uForm.clearValidate(props) |
||||
}, |
||||
setMpData() { |
||||
this.$refs.uForm.children = this.children |
||||
} |
||||
}, |
||||
} |
||||
</script> |
@ -1,47 +0,0 @@
|
||||
<template> |
||||
<uvImage |
||||
:src="src" |
||||
:mode="mode" |
||||
:width="width" |
||||
:height="height" |
||||
:shape="shape" |
||||
:radius="radius" |
||||
:lazyLoad="lazyLoad" |
||||
:showMenuByLongpress="showMenuByLongpress" |
||||
:loadingIcon="loadingIcon" |
||||
:errorIcon="errorIcon" |
||||
:showLoading="showLoading" |
||||
:showError="showError" |
||||
:fade="fade" |
||||
:webp="webp" |
||||
:duration="duration" |
||||
:bgColor="bgColor" |
||||
:customStyle="customStyle" |
||||
@click="$emit('click')" |
||||
@error="$emit('error')" |
||||
@load="$emit('load')" |
||||
> |
||||
<template v-slot:loading> |
||||
<slot name="loading"></slot> |
||||
</template> |
||||
<template v-slot:error> |
||||
<slot name="error"></slot> |
||||
</template> |
||||
</uvImage> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* 此组件存在的理由是,在nvue下,u-image被uni-app官方占用了,u-image在nvue中相当于image组件 |
||||
* 所以在nvue下,取名为u--image,内部其实还是u-iamge.vue,只不过做一层中转 |
||||
*/ |
||||
import uvImage from '../u-image/u-image.vue'; |
||||
import props from '../u-image/props.js'; |
||||
export default { |
||||
name: 'u--image', |
||||
mixins: [uni.$u.mpMixin, props, uni.$u.mixin], |
||||
components: { |
||||
uvImage |
||||
}, |
||||
} |
||||
</script> |
@ -1,72 +0,0 @@
|
||||
<template> |
||||
<uvInput |
||||
:value="value" |
||||
:type="type" |
||||
:fixed="fixed" |
||||
:disabled="disabled" |
||||
:disabledColor="disabledColor" |
||||
:clearable="clearable" |
||||
:password="password" |
||||
:maxlength="maxlength" |
||||
:placeholder="placeholder" |
||||
:placeholderClass="placeholderClass" |
||||
:placeholderStyle="placeholderStyle" |
||||
:showWordLimit="showWordLimit" |
||||
:confirmType="confirmType" |
||||
:confirmHold="confirmHold" |
||||
:holdKeyboard="holdKeyboard" |
||||
:focus="focus" |
||||
:autoBlur="autoBlur" |
||||
:disableDefaultPadding="disableDefaultPadding" |
||||
:cursor="cursor" |
||||
:cursorSpacing="cursorSpacing" |
||||
:selectionStart="selectionStart" |
||||
:selectionEnd="selectionEnd" |
||||
:adjustPosition="adjustPosition" |
||||
:inputAlign="inputAlign" |
||||
:fontSize="fontSize" |
||||
:color="color" |
||||
:prefixIcon="prefixIcon" |
||||
:suffixIcon="suffixIcon" |
||||
:suffixIconStyle="suffixIconStyle" |
||||
:prefixIconStyle="prefixIconStyle" |
||||
:border="border" |
||||
:readonly="readonly" |
||||
:shape="shape" |
||||
:customStyle="customStyle" |
||||
:formatter="formatter" |
||||
@focus="$emit('focus')" |
||||
@blur="e => $emit('blur', e)" |
||||
@keyboardheightchange="$emit('keyboardheightchange')" |
||||
@change="e => $emit('change', e)" |
||||
@input="e => $emit('input', e)" |
||||
@confirm="e => $emit('confirm', e)" |
||||
@clear="$emit('clear')" |
||||
@click="$emit('click')" |
||||
> |
||||
<!-- #ifdef MP --> |
||||
<slot name="prefix"></slot> |
||||
<slot name="suffix"></slot> |
||||
<!-- #endif --> |
||||
<!-- #ifndef MP --> |
||||
<slot name="prefix" slot="prefix"></slot> |
||||
<slot name="suffix" slot="suffix"></slot> |
||||
<!-- #endif --> |
||||
</uvInput> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* 此组件存在的理由是,在nvue下,u-input被uni-app官方占用了,u-input在nvue中相当于input组件 |
||||
* 所以在nvue下,取名为u--input,内部其实还是u-input.vue,只不过做一层中转 |
||||
*/ |
||||
import uvInput from '../u-input/u-input.vue'; |
||||
import props from '../u-input/props.js' |
||||
export default { |
||||
name: 'u--input', |
||||
mixins: [uni.$u.mpMixin, props, uni.$u.mixin], |
||||
components: { |
||||
uvInput |
||||
}, |
||||
} |
||||
</script> |
@ -1,44 +0,0 @@
|
||||
<template> |
||||
<uvText |
||||
:type="type" |
||||
:show="show" |
||||
:text="text" |
||||
:prefixIcon="prefixIcon" |
||||
:suffixIcon="suffixIcon" |
||||
:mode="mode" |
||||
:href="href" |
||||
:format="format" |
||||
:call="call" |
||||
:openType="openType" |
||||
:bold="bold" |
||||
:block="block" |
||||
:lines="lines" |
||||
:color="color" |
||||
:decoration="decoration" |
||||
:size="size" |
||||
:iconStyle="iconStyle" |
||||
:margin="margin" |
||||
:lineHeight="lineHeight" |
||||
:align="align" |
||||
:wordWrap="wordWrap" |
||||
:customStyle="customStyle" |
||||
@click="$emit('click')" |
||||
></uvText> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* 此组件存在的理由是,在nvue下,u-text被uni-app官方占用了,u-text在nvue中相当于input组件 |
||||
* 所以在nvue下,取名为u--input,内部其实还是u-text.vue,只不过做一层中转 |
||||
* 不使用v-bind="$attrs",而是分开独立写传参,是因为微信小程序不支持此写法 |
||||
*/ |
||||
import uvText from "../u-text/u-text.vue"; |
||||
import props from "../u-text/props.js"; |
||||
export default { |
||||
name: "u--text", |
||||
mixins: [uni.$u.mpMixin, props, uni.$u.mixin], |
||||
components: { |
||||
uvText, |
||||
}, |
||||
}; |
||||
</script> |
@ -1,47 +0,0 @@
|
||||
<template> |
||||
<uvTextarea |
||||
:value="value" |
||||
:placeholder="placeholder" |
||||
:height="height" |
||||
:confirmType="confirmType" |
||||
:disabled="disabled" |
||||
:count="count" |
||||
:focus="focus" |
||||
:autoHeight="autoHeight" |
||||
:fixed="fixed" |
||||
:cursorSpacing="cursorSpacing" |
||||
:cursor="cursor" |
||||
:showConfirmBar="showConfirmBar" |
||||
:selectionStart="selectionStart" |
||||
:selectionEnd="selectionEnd" |
||||
:adjustPosition="adjustPosition" |
||||
:disableDefaultPadding="disableDefaultPadding" |
||||
:holdKeyboard="holdKeyboard" |
||||
:maxlength="maxlength" |
||||
:border="border" |
||||
:customStyle="customStyle" |
||||
:formatter="formatter" |
||||
@focus="e => $emit('focus')" |
||||
@blur="e => $emit('blur')" |
||||
@linechange="e => $emit('linechange', e)" |
||||
@confirm="e => $emit('confirm')" |
||||
@input="e => $emit('input', e)" |
||||
@keyboardheightchange="e => $emit('keyboardheightchange')" |
||||
></uvTextarea> |
||||
</template> |
||||
|
||||
<script> |
||||
/** |
||||
* 此组件存在的理由是,在nvue下,u--textarea被uni-app官方占用了,u-textarea在nvue中相当于textarea组件 |
||||
* 所以在nvue下,取名为u--textarea,内部其实还是u-textarea.vue,只不过做一层中转 |
||||
*/ |
||||
import uvTextarea from '../u-textarea/u-textarea.vue'; |
||||
import props from '../u-textarea/props.js' |
||||
export default { |
||||
name: 'u--textarea', |
||||
mixins: [uni.$u.mpMixin, props, uni.$u.mixin], |
||||
components: { |
||||
uvTextarea |
||||
}, |
||||
} |
||||
</script> |
@ -1,54 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 操作菜单是否展示 (默认false)
|
||||
show: { |
||||
type: Boolean, |
||||
default: uni.$u.props.actionSheet.show |
||||
}, |
||||
// 标题
|
||||
title: { |
||||
type: String, |
||||
default: uni.$u.props.actionSheet.title |
||||
}, |
||||
// 选项上方的描述信息
|
||||
description: { |
||||
type: String, |
||||
default: uni.$u.props.actionSheet.description |
||||
}, |
||||
// 数据
|
||||
actions: { |
||||
type: Array, |
||||
default: uni.$u.props.actionSheet.actions |
||||
}, |
||||
// 取消按钮的文字,不为空时显示按钮
|
||||
cancelText: { |
||||
type: String, |
||||
default: uni.$u.props.actionSheet.cancelText |
||||
}, |
||||
// 点击某个菜单项时是否关闭弹窗
|
||||
closeOnClickAction: { |
||||
type: Boolean, |
||||
default: uni.$u.props.actionSheet.closeOnClickAction |
||||
}, |
||||
// 处理底部安全区(默认true)
|
||||
safeAreaInsetBottom: { |
||||
type: Boolean, |
||||
default: uni.$u.props.actionSheet.safeAreaInsetBottom |
||||
}, |
||||
// 小程序的打开方式
|
||||
openType: { |
||||
type: String, |
||||
default: uni.$u.props.actionSheet.openType |
||||
}, |
||||
// 点击遮罩是否允许关闭 (默认true)
|
||||
closeOnClickOverlay: { |
||||
type: Boolean, |
||||
default: uni.$u.props.actionSheet.closeOnClickOverlay |
||||
}, |
||||
// 圆角值
|
||||
round: { |
||||
type: [Boolean, String, Number], |
||||
default: uni.$u.props.actionSheet.round |
||||
} |
||||
} |
||||
} |
@ -1,278 +0,0 @@
|
||||
|
||||
<template> |
||||
<u-popup |
||||
:show="show" |
||||
mode="bottom" |
||||
@close="closeHandler" |
||||
:safeAreaInsetBottom="safeAreaInsetBottom" |
||||
:round="round" |
||||
> |
||||
<view class="u-action-sheet"> |
||||
<view |
||||
class="u-action-sheet__header" |
||||
v-if="title" |
||||
> |
||||
<text class="u-action-sheet__header__title u-line-1">{{title}}</text> |
||||
<view |
||||
class="u-action-sheet__header__icon-wrap" |
||||
@tap.stop="cancel" |
||||
> |
||||
<u-icon |
||||
name="close" |
||||
size="17" |
||||
color="#c8c9cc" |
||||
bold |
||||
></u-icon> |
||||
</view> |
||||
</view> |
||||
<text |
||||
class="u-action-sheet__description" |
||||
:style="[{ |
||||
marginTop: `${title && description ? 0 : '18px'}` |
||||
}]" |
||||
v-if="description" |
||||
>{{description}}</text> |
||||
<slot> |
||||
<u-line v-if="description"></u-line> |
||||
<view class="u-action-sheet__item-wrap"> |
||||
<template v-for="(item, index) in actions"> |
||||
<!-- #ifdef MP --> |
||||
<button |
||||
:key="index" |
||||
class="u-reset-button" |
||||
:openType="item.openType" |
||||
@getuserinfo="onGetUserInfo" |
||||
@contact="onContact" |
||||
@getphonenumber="onGetPhoneNumber" |
||||
@error="onError" |
||||
@launchapp="onLaunchApp" |
||||
@opensetting="onOpenSetting" |
||||
:lang="lang" |
||||
:session-from="sessionFrom" |
||||
:send-message-title="sendMessageTitle" |
||||
:send-message-path="sendMessagePath" |
||||
:send-message-img="sendMessageImg" |
||||
:show-message-card="showMessageCard" |
||||
:app-parameter="appParameter" |
||||
@tap="selectHandler(index)" |
||||
:hover-class="!item.disabled && !item.loading ? 'u-action-sheet--hover' : ''" |
||||
> |
||||
<!-- #endif --> |
||||
<view |
||||
class="u-action-sheet__item-wrap__item" |
||||
@tap.stop="selectHandler(index)" |
||||
:hover-class="!item.disabled && !item.loading ? 'u-action-sheet--hover' : ''" |
||||
:hover-stay-time="150" |
||||
> |
||||
<template v-if="!item.loading"> |
||||
<text |
||||
class="u-action-sheet__item-wrap__item__name" |
||||
:style="[itemStyle(index)]" |
||||
>{{ item.name }}</text> |
||||
<text |
||||
v-if="item.subname" |
||||
class="u-action-sheet__item-wrap__item__subname" |
||||
>{{ item.subname }}</text> |
||||
</template> |
||||
<u-loading-icon |
||||
v-else |
||||
custom-class="van-action-sheet__loading" |
||||
size="18" |
||||
mode="circle" |
||||
/> |
||||
</view> |
||||
<!-- #ifdef MP --> |
||||
</button> |
||||
<!-- #endif --> |
||||
<u-line v-if="index !== actions.length - 1"></u-line> |
||||
</template> |
||||
</view> |
||||
</slot> |
||||
<u-gap |
||||
bgColor="#eaeaec" |
||||
height="6" |
||||
v-if="cancelText" |
||||
></u-gap> |
||||
<view hover-class="u-action-sheet--hover"> |
||||
<text |
||||
@touchmove.stop.prevent |
||||
:hover-stay-time="150" |
||||
v-if="cancelText" |
||||
class="u-action-sheet__cancel-text" |
||||
@tap="cancel" |
||||
>{{cancelText}}</text> |
||||
</view> |
||||
</view> |
||||
</u-popup> |
||||
</template> |
||||
|
||||
<script> |
||||
import openType from '../../libs/mixin/openType' |
||||
import button from '../../libs/mixin/button' |
||||
import props from './props.js'; |
||||
/** |
||||
* ActionSheet 操作菜单 |
||||
* @description 本组件用于从底部弹出一个操作菜单,供用户选择并返回结果。本组件功能类似于uni的uni.showActionSheetAPI,配置更加灵活,所有平台都表现一致。 |
||||
* @tutorial https://www.uviewui.com/components/actionSheet.html |
||||
* |
||||
* @property {Boolean} show 操作菜单是否展示 (默认 false ) |
||||
* @property {String} title 操作菜单标题 |
||||
* @property {String} description 选项上方的描述信息 |
||||
* @property {Array<Object>} actions 按钮的文字数组,见官方文档示例 |
||||
* @property {String} cancelText 取消按钮的提示文字,不为空时显示按钮 |
||||
* @property {Boolean} closeOnClickAction 点击某个菜单项时是否关闭弹窗 (默认 true ) |
||||
* @property {Boolean} safeAreaInsetBottom 处理底部安全区 (默认 true ) |
||||
* @property {String} openType 小程序的打开方式 (contact | launchApp | getUserInfo | openSetting |getPhoneNumber |error ) |
||||
* @property {Boolean} closeOnClickOverlay 点击遮罩是否允许关闭 (默认 true ) |
||||
* @property {Number|String} round 圆角值,默认无圆角 (默认 0 ) |
||||
* @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文 |
||||
* @property {String} sessionFrom 会话来源,openType="contact"时有效 |
||||
* @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效 |
||||
* @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 |
||||
* @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效 |
||||
* @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效 (默认 false ) |
||||
* @property {String} appParameter 打开 APP 时,向 APP 传递的参数,openType=launchApp 时有效 |
||||
* |
||||
* @event {Function} select 点击ActionSheet列表项时触发 |
||||
* @event {Function} close 点击取消按钮时触发 |
||||
* @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,回调的 detail 数据与 wx.getUserInfo 返回的一致,openType="getUserInfo"时有效 |
||||
* @event {Function} contact 客服消息回调,openType="contact"时有效 |
||||
* @event {Function} getphonenumber 获取用户手机号回调,openType="getPhoneNumber"时有效 |
||||
* @event {Function} error 当使用开放能力时,发生错误的回调,openType="error"时有效 |
||||
* @event {Function} launchapp 打开 APP 成功的回调,openType="launchApp"时有效 |
||||
* @event {Function} opensetting 在打开授权设置页后回调,openType="openSetting"时有效 |
||||
* @example <u-action-sheet :actions="list" :title="title" :show="show"></u-action-sheet> |
||||
*/ |
||||
export default { |
||||
name: "u-action-sheet", |
||||
// 一些props参数和methods方法,通过mixin混入,因为其他文件也会用到 |
||||
mixins: [openType, button, uni.$u.mixin, props], |
||||
data() { |
||||
return { |
||||
|
||||
} |
||||
}, |
||||
computed: { |
||||
// 操作项目的样式 |
||||
itemStyle() { |
||||
return (index) => { |
||||
let style = {}; |
||||
if (this.actions[index].color) style.color = this.actions[index].color |
||||
if (this.actions[index].fontSize) style.fontSize = uni.$u.addUnit(this.actions[index].fontSize) |
||||
// 选项被禁用的样式 |
||||
if (this.actions[index].disabled) style.color = '#c0c4cc' |
||||
return style; |
||||
} |
||||
}, |
||||
}, |
||||
methods: { |
||||
closeHandler() { |
||||
// 允许点击遮罩关闭时,才发出close事件 |
||||
if(this.closeOnClickOverlay) { |
||||
this.$emit('close') |
||||
} |
||||
}, |
||||
// 点击取消按钮 |
||||
cancel() { |
||||
this.$emit('close') |
||||
}, |
||||
selectHandler(index) { |
||||
const item = this.actions[index] |
||||
if (item && !item.disabled && !item.loading) { |
||||
this.$emit('select', item) |
||||
if (this.closeOnClickAction) { |
||||
this.$emit('close') |
||||
} |
||||
} |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
$u-action-sheet-reset-button-width:100% !default; |
||||
$u-action-sheet-title-font-size: 16px !default; |
||||
$u-action-sheet-title-padding: 12px 30px !default; |
||||
$u-action-sheet-title-color: $u-main-color !default; |
||||
$u-action-sheet-header-icon-wrap-right:15px !default; |
||||
$u-action-sheet-header-icon-wrap-top:15px !default; |
||||
$u-action-sheet-description-font-size:13px !default; |
||||
$u-action-sheet-description-color:14px !default; |
||||
$u-action-sheet-description-margin: 18px 15px !default; |
||||
$u-action-sheet-item-wrap-item-padding:15px !default; |
||||
$u-action-sheet-item-wrap-name-font-size:16px !default; |
||||
$u-action-sheet-item-wrap-subname-font-size:13px !default; |
||||
$u-action-sheet-item-wrap-subname-color: #c0c4cc !default; |
||||
$u-action-sheet-item-wrap-subname-margin-top:10px !default; |
||||
$u-action-sheet-cancel-text-font-size:16px !default; |
||||
$u-action-sheet-cancel-text-color:$u-content-color !default; |
||||
$u-action-sheet-cancel-text-font-size:15px !default; |
||||
$u-action-sheet-cancel-text-hover-background-color:rgb(242, 243, 245) !default; |
||||
|
||||
.u-reset-button { |
||||
width: $u-action-sheet-reset-button-width; |
||||
} |
||||
|
||||
.u-action-sheet { |
||||
text-align: center; |
||||
&__header { |
||||
position: relative; |
||||
padding: $u-action-sheet-title-padding; |
||||
&__title { |
||||
font-size: $u-action-sheet-title-font-size; |
||||
color: $u-action-sheet-title-color; |
||||
font-weight: bold; |
||||
text-align: center; |
||||
} |
||||
|
||||
&__icon-wrap { |
||||
position: absolute; |
||||
right: $u-action-sheet-header-icon-wrap-right; |
||||
top: $u-action-sheet-header-icon-wrap-top; |
||||
} |
||||
} |
||||
|
||||
&__description { |
||||
font-size: $u-action-sheet-description-font-size; |
||||
color: $u-tips-color; |
||||
margin: $u-action-sheet-description-margin; |
||||
text-align: center; |
||||
} |
||||
|
||||
&__item-wrap { |
||||
|
||||
&__item { |
||||
padding: $u-action-sheet-item-wrap-item-padding; |
||||
@include flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
flex-direction: column; |
||||
|
||||
&__name { |
||||
font-size: $u-action-sheet-item-wrap-name-font-size; |
||||
color: $u-main-color; |
||||
text-align: center; |
||||
} |
||||
|
||||
&__subname { |
||||
font-size: $u-action-sheet-item-wrap-subname-font-size; |
||||
color: $u-action-sheet-item-wrap-subname-color; |
||||
margin-top: $u-action-sheet-item-wrap-subname-margin-top; |
||||
text-align: center; |
||||
} |
||||
} |
||||
} |
||||
|
||||
&__cancel-text { |
||||
font-size: $u-action-sheet-cancel-text-font-size; |
||||
color: $u-action-sheet-cancel-text-color; |
||||
text-align: center; |
||||
padding: $u-action-sheet-cancel-text-font-size; |
||||
} |
||||
|
||||
&--hover { |
||||
background-color: $u-action-sheet-cancel-text-hover-background-color; |
||||
} |
||||
} |
||||
</style> |
@ -1,59 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 图片地址,Array<String>|Array<Object>形式
|
||||
urls: { |
||||
type: Array, |
||||
default: uni.$u.props.album.urls |
||||
}, |
||||
// 指定从数组的对象元素中读取哪个属性作为图片地址
|
||||
keyName: { |
||||
type: String, |
||||
default: uni.$u.props.album.keyName |
||||
}, |
||||
// 单图时,图片长边的长度
|
||||
singleSize: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.album.singleSize |
||||
}, |
||||
// 多图时,图片边长
|
||||
multipleSize: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.album.multipleSize |
||||
}, |
||||
// 多图时,图片水平和垂直之间的间隔
|
||||
space: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.album.space |
||||
}, |
||||
// 单图时,图片缩放裁剪的模式
|
||||
singleMode: { |
||||
type: String, |
||||
default: uni.$u.props.album.singleMode |
||||
}, |
||||
// 多图时,图片缩放裁剪的模式
|
||||
multipleMode: { |
||||
type: String, |
||||
default: uni.$u.props.album.multipleMode |
||||
}, |
||||
// 最多展示的图片数量,超出时最后一个位置将会显示剩余图片数量
|
||||
maxCount: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.album.maxCount |
||||
}, |
||||
// 是否可以预览图片
|
||||
previewFullImage: { |
||||
type: Boolean, |
||||
default: uni.$u.props.album.previewFullImage |
||||
}, |
||||
// 每行展示图片数量,如设置,singleSize和multipleSize将会无效
|
||||
rowCount: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.album.rowCount |
||||
}, |
||||
// 超出maxCount时是否显示查看更多的提示
|
||||
showMore: { |
||||
type: Boolean, |
||||
default: uni.$u.props.album.showMore |
||||
} |
||||
} |
||||
} |
@ -1,259 +0,0 @@
|
||||
<template> |
||||
<view class="u-album"> |
||||
<view |
||||
class="u-album__row" |
||||
ref="u-album__row" |
||||
v-for="(arr, index) in showUrls" |
||||
:forComputedUse="albumWidth" |
||||
:key="index" |
||||
> |
||||
<view |
||||
class="u-album__row__wrapper" |
||||
v-for="(item, index1) in arr" |
||||
:key="index1" |
||||
:style="[imageStyle(index + 1, index1 + 1)]" |
||||
@tap="previewFullImage ? onPreviewTap(getSrc(item)) : ''" |
||||
> |
||||
<image |
||||
:src="getSrc(item)" |
||||
:mode=" |
||||
urls.length === 1 |
||||
? imageHeight > 0 |
||||
? singleMode |
||||
: 'widthFix' |
||||
: multipleMode |
||||
" |
||||
:style="[ |
||||
{ |
||||
width: imageWidth, |
||||
height: imageHeight |
||||
} |
||||
]" |
||||
></image> |
||||
<view |
||||
v-if=" |
||||
showMore && |
||||
urls.length > rowCount * showUrls.length && |
||||
index === showUrls.length - 1 && |
||||
index1 === showUrls[showUrls.length - 1].length - 1 |
||||
" |
||||
class="u-album__row__wrapper__text" |
||||
> |
||||
<u--text |
||||
:text="`+${urls.length - maxCount}`" |
||||
color="#fff" |
||||
:size="multipleSize * 0.3" |
||||
align="center" |
||||
customStyle="justify-content: center" |
||||
></u--text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import props from './props.js' |
||||
// #ifdef APP-NVUE |
||||
// 由于weex为阿里的KPI业绩考核的产物,所以不支持百分比单位,这里需要通过dom查询组件的宽度 |
||||
const dom = uni.requireNativePlugin('dom') |
||||
// #endif |
||||
|
||||
/** |
||||
* Album 相册 |
||||
* @description 本组件提供一个类似相册的功能,让开发者开发起来更加得心应手。减少重复的模板代码 |
||||
* @tutorial https://www.uviewui.com/components/album.html |
||||
* |
||||
* @property {Array} urls 图片地址列表 Array<String>|Array<Object>形式 |
||||
* @property {String} keyName 指定从数组的对象元素中读取哪个属性作为图片地址 |
||||
* @property {String | Number} singleSize 单图时,图片长边的长度 (默认 180 ) |
||||
* @property {String | Number} multipleSize 多图时,图片边长 (默认 70 ) |
||||
* @property {String | Number} space 多图时,图片水平和垂直之间的间隔 (默认 6 ) |
||||
* @property {String} singleMode 单图时,图片缩放裁剪的模式 (默认 'scaleToFill' ) |
||||
* @property {String} multipleMode 多图时,图片缩放裁剪的模式 (默认 'aspectFill' ) |
||||
* @property {String | Number} maxCount 取消按钮的提示文字 (默认 9 ) |
||||
* @property {Boolean} previewFullImage 是否可以预览图片 (默认 true ) |
||||
* @property {String | Number} rowCount 每行展示图片数量,如设置,singleSize和multipleSize将会无效 (默认 3 ) |
||||
* @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true ) |
||||
* |
||||
* @event {Function} albumWidth 某些特殊的情况下,需要让文字与相册的宽度相等,这里事件的形式对外发送 (回调参数 width ) |
||||
* @example <u-album :urls="urls2" @albumWidth="width => albumWidth = width" multipleSize="68" ></u-album> |
||||
*/ |
||||
export default { |
||||
name: 'u-album', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
||||
data() { |
||||
return { |
||||
// 单图的宽度 |
||||
singleWidth: 0, |
||||
// 单图的高度 |
||||
singleHeight: 0, |
||||
// 单图时,如果无法获取图片的尺寸信息,让图片宽度默认为容器的一定百分比 |
||||
singlePercent: 0.6 |
||||
} |
||||
}, |
||||
watch: { |
||||
urls: { |
||||
immediate: true, |
||||
handler(newVal) { |
||||
if (newVal.length === 1) { |
||||
this.getImageRect() |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
imageStyle() { |
||||
return (index1, index2) => { |
||||
const { space, rowCount, multipleSize, urls } = this, |
||||
{ addUnit, addStyle } = uni.$u, |
||||
rowLen = this.showUrls.length, |
||||
allLen = this.urls.length |
||||
const style = { |
||||
marginRight: addUnit(space), |
||||
marginBottom: addUnit(space) |
||||
} |
||||
// 如果为最后一行,则每个图片都无需下边框 |
||||
if (index1 === rowLen) style.marginBottom = 0 |
||||
// 每行的最右边一张和总长度的最后一张无需右边框 |
||||
if ( |
||||
index2 === rowCount || |
||||
(index1 === rowLen && |
||||
index2 === this.showUrls[index1 - 1].length) |
||||
) |
||||
style.marginRight = 0 |
||||
return style |
||||
} |
||||
}, |
||||
// 将数组划分为二维数组 |
||||
showUrls() { |
||||
const arr = [] |
||||
this.urls.map((item, index) => { |
||||
// 限制最大展示数量 |
||||
if (index + 1 <= this.maxCount) { |
||||
// 计算该元素为第几个素组内 |
||||
const itemIndex = Math.floor(index / this.rowCount) |
||||
// 判断对应的索引是否存在 |
||||
if (!arr[itemIndex]) { |
||||
arr[itemIndex] = [] |
||||
} |
||||
arr[itemIndex].push(item) |
||||
} |
||||
}) |
||||
return arr |
||||
}, |
||||
imageWidth() { |
||||
return uni.$u.addUnit( |
||||
this.urls.length === 1 ? this.singleWidth : this.multipleSize |
||||
) |
||||
}, |
||||
imageHeight() { |
||||
return uni.$u.addUnit( |
||||
this.urls.length === 1 ? this.singleHeight : this.multipleSize |
||||
) |
||||
}, |
||||
// 此变量无实际用途,仅仅是为了利用computed特性,让其在urls长度等变化时,重新计算图片的宽度 |
||||
// 因为用户在某些特殊的情况下,需要让文字与相册的宽度相等,所以这里事件的形式对外发送 |
||||
albumWidth() { |
||||
let width = 0 |
||||
if (this.urls.length === 1) { |
||||
width = this.singleWidth |
||||
} else { |
||||
width = |
||||
this.showUrls[0].length * this.multipleSize + |
||||
this.space * (this.showUrls[0].length - 1) |
||||
} |
||||
this.$emit('albumWidth', width) |
||||
return width |
||||
} |
||||
}, |
||||
methods: { |
||||
// 预览图片 |
||||
onPreviewTap(url) { |
||||
const urls = this.urls.map((item) => { |
||||
return this.getSrc(item) |
||||
}) |
||||
uni.previewImage({ |
||||
current: url, |
||||
urls |
||||
}) |
||||
}, |
||||
// 获取图片的路径 |
||||
getSrc(item) { |
||||
return uni.$u.test.object(item) |
||||
? (this.keyName && item[this.keyName]) || item.src |
||||
: item |
||||
}, |
||||
// 单图时,获取图片的尺寸 |
||||
// 在小程序中,需要将网络图片的的域名添加到小程序的download域名才可能获取尺寸 |
||||
// 在没有添加的情况下,让单图宽度默认为盒子的一定宽度(singlePercent) |
||||
getImageRect() { |
||||
const src = this.getSrc(this.urls[0]) |
||||
uni.getImageInfo({ |
||||
src, |
||||
success: (res) => { |
||||
// 判断图片横向还是竖向展示方式 |
||||
const isHorizotal = res.width >= res.height |
||||
this.singleWidth = isHorizotal |
||||
? this.singleSize |
||||
: (res.width / res.height) * this.singleSize |
||||
this.singleHeight = !isHorizotal |
||||
? this.singleSize |
||||
: (res.height / res.width) * this.singleWidth |
||||
}, |
||||
fail: () => { |
||||
this.getComponentWidth() |
||||
} |
||||
}) |
||||
}, |
||||
// 获取组件的宽度 |
||||
async getComponentWidth() { |
||||
// 延时一定时间,以获取dom尺寸 |
||||
await uni.$u.sleep(30) |
||||
// #ifndef APP-NVUE |
||||
this.$uGetRect('.u-album__row').then((size) => { |
||||
this.singleWidth = size.width * this.singlePercent |
||||
}) |
||||
// #endif |
||||
|
||||
// #ifdef APP-NVUE |
||||
// 这里ref="u-album__row"所在的标签为通过for循环出来,导致this.$refs['u-album__row']是一个数组 |
||||
const ref = this.$refs['u-album__row'][0] |
||||
ref && |
||||
dom.getComponentRect(ref, (res) => { |
||||
this.singleWidth = res.size.width * this.singlePercent |
||||
}) |
||||
// #endif |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import '../../libs/css/components.scss'; |
||||
|
||||
.u-album { |
||||
@include flex(column); |
||||
|
||||
&__row { |
||||
@include flex(row); |
||||
flex-wrap: wrap; |
||||
|
||||
&__wrapper { |
||||
position: relative; |
||||
|
||||
&__text { |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
right: 0; |
||||
bottom: 0; |
||||
background-color: rgba(0, 0, 0, 0.3); |
||||
@include flex(row); |
||||
justify-content: center; |
||||
align-items: center; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -1,44 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 显示文字
|
||||
title: { |
||||
type: String, |
||||
default: uni.$u.props.alert.title |
||||
}, |
||||
// 主题,success/warning/info/error
|
||||
type: { |
||||
type: String, |
||||
default: uni.$u.props.alert.type |
||||
}, |
||||
// 辅助性文字
|
||||
description: { |
||||
type: String, |
||||
default: uni.$u.props.alert.description |
||||
}, |
||||
// 是否可关闭
|
||||
closable: { |
||||
type: Boolean, |
||||
default: uni.$u.props.alert.closable |
||||
}, |
||||
// 是否显示图标
|
||||
showIcon: { |
||||
type: Boolean, |
||||
default: uni.$u.props.alert.showIcon |
||||
}, |
||||
// 浅或深色调,light-浅色,dark-深色
|
||||
effect: { |
||||
type: String, |
||||
default: uni.$u.props.alert.effect |
||||
}, |
||||
// 文字是否居中
|
||||
center: { |
||||
type: Boolean, |
||||
default: uni.$u.props.alert.center |
||||
}, |
||||
// 字体大小
|
||||
fontSize: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.alert.fontSize |
||||
} |
||||
} |
||||
} |
@ -1,243 +0,0 @@
|
||||
<template> |
||||
<u-transition |
||||
mode="fade" |
||||
:show="show" |
||||
> |
||||
<view |
||||
class="u-alert" |
||||
:class="[`u-alert--${type}--${effect}`]" |
||||
@tap.stop="clickHandler" |
||||
:style="[$u.addStyle(customStyle)]" |
||||
> |
||||
<view |
||||
class="u-alert__icon" |
||||
v-if="showIcon" |
||||
> |
||||
<u-icon |
||||
:name="iconName" |
||||
size="18" |
||||
:color="iconColor" |
||||
></u-icon> |
||||
</view> |
||||
<view |
||||
class="u-alert__content" |
||||
:style="[{ |
||||
paddingRight: closable ? '20px' : 0 |
||||
}]" |
||||
> |
||||
<text |
||||
class="u-alert__content__title" |
||||
v-if="title" |
||||
:style="[{ |
||||
fontSize: $u.addUnit(fontSize), |
||||
textAlign: center ? 'center' : 'left' |
||||
}]" |
||||
:class="[effect === 'dark' ? 'u-alert__text--dark' : `u-alert__text--${type}--light`]" |
||||
>{{ title }}</text> |
||||
<text |
||||
class="u-alert__content__desc" |
||||
v-if="description" |
||||
:style="[{ |
||||
fontSize: $u.addUnit(fontSize), |
||||
textAlign: center ? 'center' : 'left' |
||||
}]" |
||||
:class="[effect === 'dark' ? 'u-alert__text--dark' : `u-alert__text--${type}--light`]" |
||||
>{{ description }}</text> |
||||
</view> |
||||
<view |
||||
class="u-alert__close" |
||||
v-if="closable" |
||||
@tap.stop="closeHandler" |
||||
> |
||||
<u-icon |
||||
name="close" |
||||
:color="iconColor" |
||||
size="15" |
||||
></u-icon> |
||||
</view> |
||||
</view> |
||||
</u-transition> |
||||
</template> |
||||
|
||||
<script> |
||||
import props from './props.js'; |
||||
/** |
||||
* Alert 警告提示 |
||||
* @description 警告提示,展现需要关注的信息。 |
||||
* @tutorial https://www.uviewui.com/components/alertTips.html |
||||
* |
||||
* @property {String} title 显示的文字 |
||||
* @property {String} type 使用预设的颜色 (默认 'warning' ) |
||||
* @property {String} description 辅助性文字,颜色比title浅一点,字号也小一点,可选 |
||||
* @property {Boolean} closable 关闭按钮(默认为叉号icon图标) (默认 false ) |
||||
* @property {Boolean} showIcon 是否显示左边的辅助图标 ( 默认 false ) |
||||
* @property {String} effect 多图时,图片缩放裁剪的模式 (默认 'light' ) |
||||
* @property {Boolean} center 文字是否居中 (默认 false ) |
||||
* @property {String | Number} fontSize 字体大小 (默认 14 ) |
||||
* @property {Object} customStyle 定义需要用到的外部样式 |
||||
* @event {Function} click 点击组件时触发 |
||||
* @example <u-alert :title="title" type = "warning" :closable="closable" :description = "description"></u-alert> |
||||
*/ |
||||
export default { |
||||
name: 'u-alert', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
||||
data() { |
||||
return { |
||||
show: true |
||||
} |
||||
}, |
||||
computed: { |
||||
iconColor() { |
||||
return this.effect === 'light' ? this.type : '#fff' |
||||
}, |
||||
// 不同主题对应不同的图标 |
||||
iconName() { |
||||
switch (this.type) { |
||||
case 'success': |
||||
return 'checkmark-circle-fill'; |
||||
break; |
||||
case 'error': |
||||
return 'close-circle-fill'; |
||||
break; |
||||
case 'warning': |
||||
return 'error-circle-fill'; |
||||
break; |
||||
case 'info': |
||||
return 'info-circle-fill'; |
||||
break; |
||||
case 'primary': |
||||
return 'more-circle-fill'; |
||||
break; |
||||
default: |
||||
return 'error-circle-fill'; |
||||
} |
||||
} |
||||
}, |
||||
methods: { |
||||
// 点击内容 |
||||
clickHandler() { |
||||
this.$emit('click') |
||||
}, |
||||
// 点击关闭按钮 |
||||
closeHandler() { |
||||
this.show = false |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
.u-alert { |
||||
position: relative; |
||||
background-color: $u-primary; |
||||
padding: 8px 10px; |
||||
@include flex(row); |
||||
align-items: center; |
||||
border-top-left-radius: 4px; |
||||
border-top-right-radius: 4px; |
||||
border-bottom-left-radius: 4px; |
||||
border-bottom-right-radius: 4px; |
||||
|
||||
&--primary--dark { |
||||
background-color: $u-primary; |
||||
} |
||||
|
||||
&--primary--light { |
||||
background-color: #ecf5ff; |
||||
} |
||||
|
||||
&--error--dark { |
||||
background-color: $u-error; |
||||
} |
||||
|
||||
&--error--light { |
||||
background-color: #FEF0F0; |
||||
} |
||||
|
||||
&--success--dark { |
||||
background-color: $u-success; |
||||
} |
||||
|
||||
&--success--light { |
||||
background-color: #f5fff0; |
||||
} |
||||
|
||||
&--warning--dark { |
||||
background-color: $u-warning; |
||||
} |
||||
|
||||
&--warning--light { |
||||
background-color: #FDF6EC; |
||||
} |
||||
|
||||
&--info--dark { |
||||
background-color: $u-info; |
||||
} |
||||
|
||||
&--info--light { |
||||
background-color: #f4f4f5; |
||||
} |
||||
|
||||
&__icon { |
||||
margin-right: 5px; |
||||
} |
||||
|
||||
&__content { |
||||
@include flex(column); |
||||
flex: 1; |
||||
|
||||
&__title { |
||||
color: $u-main-color; |
||||
font-size: 14px; |
||||
font-weight: bold; |
||||
color: #fff; |
||||
margin-bottom: 2px; |
||||
} |
||||
|
||||
&__desc { |
||||
color: $u-main-color; |
||||
font-size: 14px; |
||||
flex-wrap: wrap; |
||||
color: #fff; |
||||
} |
||||
} |
||||
|
||||
&__title--dark, |
||||
&__desc--dark { |
||||
color: #FFFFFF; |
||||
} |
||||
|
||||
&__text--primary--light, |
||||
&__text--primary--light { |
||||
color: $u-primary; |
||||
} |
||||
|
||||
&__text--success--light, |
||||
&__text--success--light { |
||||
color: $u-success; |
||||
} |
||||
|
||||
&__text--warning--light, |
||||
&__text--warning--light { |
||||
color: $u-warning; |
||||
} |
||||
|
||||
&__text--error--light, |
||||
&__text--error--light { |
||||
color: $u-error; |
||||
} |
||||
|
||||
&__text--info--light, |
||||
&__text--info--light { |
||||
color: $u-info; |
||||
} |
||||
|
||||
&__close { |
||||
position: absolute; |
||||
top: 11px; |
||||
right: 10px; |
||||
} |
||||
} |
||||
</style> |
@ -1,52 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 头像图片组
|
||||
urls: { |
||||
type: Array, |
||||
default: uni.$u.props.avatarGroup.urls |
||||
}, |
||||
// 最多展示的头像数量
|
||||
maxCount: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.avatarGroup.maxCount |
||||
}, |
||||
// 头像形状
|
||||
shape: { |
||||
type: String, |
||||
default: uni.$u.props.avatarGroup.shape |
||||
}, |
||||
// 图片裁剪模式
|
||||
mode: { |
||||
type: String, |
||||
default: uni.$u.props.avatarGroup.mode |
||||
}, |
||||
// 超出maxCount时是否显示查看更多的提示
|
||||
showMore: { |
||||
type: Boolean, |
||||
default: uni.$u.props.avatarGroup.showMore |
||||
}, |
||||
// 头像大小
|
||||
size: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.avatarGroup.size |
||||
}, |
||||
// 指定从数组的对象元素中读取哪个属性作为图片地址
|
||||
keyName: { |
||||
type: String, |
||||
default: uni.$u.props.avatarGroup.keyName |
||||
}, |
||||
// 头像之间的遮挡比例
|
||||
gap: { |
||||
type: [String, Number], |
||||
validator(value) { |
||||
return value >= 0 && value <= 1 |
||||
}, |
||||
default: uni.$u.props.avatarGroup.gap |
||||
}, |
||||
// 需额外显示的值
|
||||
extraValue: { |
||||
type: [Number, String], |
||||
default: uni.$u.props.avatarGroup.extraValue |
||||
} |
||||
} |
||||
} |
@ -1,103 +0,0 @@
|
||||
<template> |
||||
<view class="u-avatar-group"> |
||||
<view |
||||
class="u-avatar-group__item" |
||||
v-for="(item, index) in showUrl" |
||||
:key="index" |
||||
:style="{ |
||||
marginLeft: index === 0 ? 0 : $u.addUnit(-size * gap) |
||||
}" |
||||
> |
||||
<u-avatar |
||||
:size="size" |
||||
:shape="shape" |
||||
:mode="mode" |
||||
:src="$u.test.object(item) ? keyName && item[keyName] || item.url : item" |
||||
></u-avatar> |
||||
<view |
||||
class="u-avatar-group__item__show-more" |
||||
v-if="showMore && index === showUrl.length - 1 && (urls.length > maxCount || extraValue > 0)" |
||||
@tap="clickHandler" |
||||
> |
||||
<u--text |
||||
color="#ffffff" |
||||
:size="size * 0.4" |
||||
:text="`+${extraValue || urls.length - showUrl.length}`" |
||||
align="center" |
||||
customStyle="justify-content: center" |
||||
></u--text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import props from './props.js'; |
||||
/** |
||||
* AvatarGroup 头像组 |
||||
* @description 本组件一般用于展示头像的地方,如个人中心,或者评论列表页的用户头像展示等场所。 |
||||
* @tutorial https://www.uviewui.com/components/avatar.html |
||||
* |
||||
* @property {Array} urls 头像图片组 (默认 [] ) |
||||
* @property {String | Number} maxCount 最多展示的头像数量 ( 默认 5 ) |
||||
* @property {String} shape 头像形状( 'circle' (默认) | 'square' ) |
||||
* @property {String} mode 图片裁剪模式(默认 'scaleToFill' ) |
||||
* @property {Boolean} showMore 超出maxCount时是否显示查看更多的提示 (默认 true ) |
||||
* @property {String | Number} size 头像大小 (默认 40 ) |
||||
* @property {String} keyName 指定从数组的对象元素中读取哪个属性作为图片地址 |
||||
* @property {String | Number} gap 头像之间的遮挡比例(0.4代表遮挡40%) (默认 0.5 ) |
||||
* @property {String | Number} extraValue 需额外显示的值 |
||||
* @event {Function} showMore 头像组更多点击 |
||||
* @example <u-avatar-group:urls="urls" size="35" gap="0.4" ></u-avatar-group:urls=> |
||||
*/ |
||||
export default { |
||||
name: 'u-avatar-group', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
||||
data() { |
||||
return { |
||||
|
||||
} |
||||
}, |
||||
computed: { |
||||
showUrl() { |
||||
return this.urls.slice(0, this.maxCount) |
||||
} |
||||
}, |
||||
methods: { |
||||
clickHandler() { |
||||
this.$emit('showMore') |
||||
} |
||||
}, |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
.u-avatar-group { |
||||
@include flex; |
||||
|
||||
&__item { |
||||
margin-left: -10px; |
||||
position: relative; |
||||
|
||||
&--no-indent { |
||||
// 如果你想质疑作者不会使用:first-child,说明你太年轻,因为nvue不支持 |
||||
margin-left: 0; |
||||
} |
||||
|
||||
&__show-more { |
||||
position: absolute; |
||||
top: 0; |
||||
bottom: 0; |
||||
left: 0; |
||||
right: 0; |
||||
background-color: rgba(0, 0, 0, 0.3); |
||||
@include flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
border-radius: 100px; |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -1,78 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 头像图片路径(不能为相对路径)
|
||||
src: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.src |
||||
}, |
||||
// 头像形状,circle-圆形,square-方形
|
||||
shape: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.shape |
||||
}, |
||||
// 头像尺寸
|
||||
size: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.avatar.size |
||||
}, |
||||
// 裁剪模式
|
||||
mode: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.mode |
||||
}, |
||||
// 显示的文字
|
||||
text: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.text |
||||
}, |
||||
// 背景色
|
||||
bgColor: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.bgColor |
||||
}, |
||||
// 文字颜色
|
||||
color: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.color |
||||
}, |
||||
// 文字大小
|
||||
fontSize: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.avatar.fontSize |
||||
}, |
||||
// 显示的图标
|
||||
icon: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.icon |
||||
}, |
||||
// 显示小程序头像,只对百度,微信,QQ小程序有效
|
||||
mpAvatar: { |
||||
type: Boolean, |
||||
default: uni.$u.props.avatar.mpAvatar |
||||
}, |
||||
// 是否使用随机背景色
|
||||
randomBgColor: { |
||||
type: Boolean, |
||||
default: uni.$u.props.avatar.randomBgColor |
||||
}, |
||||
// 加载失败的默认头像(组件有内置默认图片)
|
||||
defaultUrl: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.defaultUrl |
||||
}, |
||||
// 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间
|
||||
colorIndex: { |
||||
type: [String, Number], |
||||
// 校验参数规则,索引在0-19之间
|
||||
validator(n) { |
||||
return uni.$u.test.range(n, [0, 19]) || n === '' |
||||
}, |
||||
default: uni.$u.props.avatar.colorIndex |
||||
}, |
||||
// 组件标识符
|
||||
name: { |
||||
type: String, |
||||
default: uni.$u.props.avatar.name |
||||
} |
||||
} |
||||
} |
@ -1,172 +0,0 @@
|
||||
<template> |
||||
<view |
||||
class="u-avatar" |
||||
:class="[`u-avatar--${shape}`]" |
||||
:style="[{ |
||||
backgroundColor: (text || icon) ? (randomBgColor ? colors[colorIndex !== '' ? colorIndex : $u.random(0, 19)] : bgColor) : 'transparent', |
||||
width: $u.addUnit(size), |
||||
height: $u.addUnit(size), |
||||
}, $u.addStyle(customStyle)]" |
||||
@tap="clickHandler" |
||||
> |
||||
<slot> |
||||
<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU --> |
||||
<open-data |
||||
v-if="mpAvatar && allowMp" |
||||
type="userAvatarUrl" |
||||
:style="[{ |
||||
width: $u.addUnit(size), |
||||
height: $u.addUnit(size) |
||||
}]" |
||||
/> |
||||
<!-- #endif --> |
||||
<!-- #ifndef MP-WEIXIN && MP-QQ && MP-BAIDU --> |
||||
<template v-if="mpAvatar && allowMp"></template> |
||||
<!-- #endif --> |
||||
<u-icon |
||||
v-else-if="icon" |
||||
:name="icon" |
||||
:size="fontSize" |
||||
:color="color" |
||||
></u-icon> |
||||
<u--text |
||||
v-else-if="text" |
||||
:text="text" |
||||
:size="fontSize" |
||||
:color="color" |
||||
align="center" |
||||
customStyle="justify-content: center" |
||||
></u--text> |
||||
<image |
||||
class="u-avatar__image" |
||||
v-else |
||||
:class="[`u-avatar__image--${shape}`]" |
||||
:src="avatarUrl || defaultUrl" |
||||
:mode="mode" |
||||
@error="errorHandler" |
||||
:style="[{ |
||||
width: $u.addUnit(size), |
||||
height: $u.addUnit(size) |
||||
}]" |
||||
></image> |
||||
</slot> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import props from './props.js'; |
||||
const base64Avatar = |
||||
"data:image/jpg;base64,/9j/4QAYRXhpZgAASUkqAAgAAAAAAAAAAAAAAP/sABFEdWNreQABAAQAAAA8AAD/4QMraHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLwA8P3hwYWNrZXQgYmVnaW49Iu+7vyIgaWQ9Ilc1TTBNcENlaGlIenJlU3pOVGN6a2M5ZCI/PiA8eDp4bXBtZXRhIHhtbG5zOng9ImFkb2JlOm5zOm1ldGEvIiB4OnhtcHRrPSJBZG9iZSBYTVAgQ29yZSA1LjMtYzAxMSA2Ni4xNDU2NjEsIDIwMTIvMDIvMDYtMTQ6NTY6MjcgICAgICAgICI+IDxyZGY6UkRGIHhtbG5zOnJkZj0iaHR0cDovL3d3dy53My5vcmcvMTk5OS8wMi8yMi1yZGYtc3ludGF4LW5zIyI+IDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiIHhtbG5zOnhtcD0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bXA6Q3JlYXRvclRvb2w9IkFkb2JlIFBob3Rvc2hvcCBDUzYgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjREMEQwRkY0RjgwNDExRUE5OTY2RDgxODY3NkJFODMxIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjREMEQwRkY1RjgwNDExRUE5OTY2RDgxODY3NkJFODMxIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6NEQwRDBGRjJGODA0MTFFQTk5NjZEODE4Njc2QkU4MzEiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6NEQwRDBGRjNGODA0MTFFQTk5NjZEODE4Njc2QkU4MzEiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz7/7gAOQWRvYmUAZMAAAAAB/9sAhAAGBAQEBQQGBQUGCQYFBgkLCAYGCAsMCgoLCgoMEAwMDAwMDBAMDg8QDw4MExMUFBMTHBsbGxwfHx8fHx8fHx8fAQcHBw0MDRgQEBgaFREVGh8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx//wAARCADIAMgDAREAAhEBAxEB/8QAcQABAQEAAwEBAAAAAAAAAAAAAAUEAQMGAgcBAQAAAAAAAAAAAAAAAAAAAAAQAAIBAwICBgkDBQAAAAAAAAABAhEDBCEFMVFBYXGREiKBscHRMkJSEyOh4XLxYjNDFBEBAAAAAAAAAAAAAAAAAAAAAP/aAAwDAQACEQMRAD8A/fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHbHFyZ/Dam+yLA+Z2L0Pjtyj2poD4AAAAAAAAAAAAAAAAAAAAAAAAKWFs9y6lcvvwQeqj8z9wFaziY1n/HbUX9XF97A7QAGXI23EvJ1goyfzR0YEfN269jeZ+a03pNe0DIAAAAAAAAAAAAAAAAAAAACvtO3RcVkXlWutuL9YFYAAAAAOJRjKLjJVi9GmB5/csH/mu1h/in8PU+QGMAAAAAAAAAAAAAAAAAAaMDG/6MmMH8C80+xAelSSVFolwQAAAAAAAHVlWI37ErUulaPk+hgeYnCUJuElSUXRrrQHAAAAAAAAAAAAAAAAABa2Oz4bM7r4zdF2ICmAAAAAAAAAg7zZ8GX41wuJP0rRgYAAAAAAAAAAAAAAAAAD0m2R8ODaXU33tsDSAAAAAAAAAlb9HyWZcnJd9PcBHAAAAAAAAAAAAAAAAAPS7e64Vn+KA0AAAAAAAAAJm+v8Ftf3ewCKAAAAAAAAAAAAAAAAAX9muqeGo9NttP06+0DcAAAAAAAAAjb7dTu2ra+VOT9P8AQCWAAAAAAAAAAAAAAAAAUNmyPt5Ltv4bui/kuAF0AAAAAAADiUlGLlJ0SVW+oDzOXfd/Ind6JPRdS0QHSAAAAAAAAAAAAAAAAAE2nVaNcGB6Lbs6OTao9LsF51z60BrAAAAAABJ3jOVHjW3r/sa9QEgAAAAAAAAAAAAAAAAAAAPu1duWriuW34ZR4MC9hbnZyEoy8l36XwfYBsAAADaSq9EuLAlZ+7xSdrGdW9Hc5dgEdtt1erfFgAAAAAAAAAAAAAAAAADVjbblX6NR8MH80tEBRs7HYivyzlN8lovaBPzduvY0m6eK10TXtAyAarO55lpJK54orolr+4GqO/Xaea1FvqbXvA+Z77kNeW3GPbV+4DJfzcm/pcm3H6Vou5AdAFLC2ed2Pjv1txa8sV8T6wOL+yZEKu1JXFy4MDBOE4ScZxcZLinoB8gAAAAAAAAAAAB242LeyJ+C3GvN9C7QLmJtePYpKS+5c+p8F2IDYAANJqj1T4oCfk7Nj3G5Wn9qXJax7gJ93Z82D8sVNc4v30A6Xg5i42Z+iLfqARwcyT0sz9MWvWBps7LlTf5Grce9/oBTxdtxseklHxT+uWr9AGoAB138ezfj4bsFJdD6V2MCPm7RdtJzs1uW1xXzL3gTgAAAAAAAAADRhYc8q74I6RWs5ckB6GxYtWLat21SK731sDsAAAAAAAAAAAAAAAASt021NO/YjrxuQXT1oCOAAAAAAABzGLlJRSq26JAelwsWONYjbXxcZvmwO8AAAAAAAAAAAAAAAAAAef3TEWPkVivx3NY9T6UBiAAAAAABo2+VmGXblddIJ8eivRUD0oAAAAAAAAAAAAAAAAAAAYt4tKeFKVNYNSXfRgefAAAAAAAAr7VuSSWPedKaW5v1MCsAAAAAAAAAAAAAAAAAAIe6bj96Ts2n+JPzSXzP3ATgAAAAAAAAFbbt1UUrOQ9FpC4/UwK6aaqtU+DAAAAAAAAAAAAAAA4lKMIuUmoxWrb4ARNx3R3q2rLpa4Sl0y/YCcAAAAAAAAAAANmFud7G8r89r6X0dgFvGzLGRGtuWvTF6NAdwAAAAAAAAAAAy5W442PVN+K59EePp5ARMvOv5MvO6QXCC4AZwAAAAAAAAAAAAAcxlKLUotprg1owN+PvORborq+7Hnwl3gUbO74VzRydt8pKn68ANcJwmqwkpLmnUDkAAAAfNy9atqtyagut0AxXt5xIV8Fbj6lRd7Am5G65V6qUvtwfyx94GMAAAAAAAAAAAAAAAAAAAOU2nVOj5gdsc3LiqRvTpyqwOxbnnrhdfpSfrQB7pnv/AGvuS9gHXPMy5/Fem1yq0v0A6W29XqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAf//Z"; |
||||
/** |
||||
* Avatar 头像 |
||||
* @description 本组件一般用于展示头像的地方,如个人中心,或者评论列表页的用户头像展示等场所。 |
||||
* @tutorial https://www.uviewui.com/components/avatar.html |
||||
* |
||||
* @property {String} src 头像路径,如加载失败,将会显示默认头像(不能为相对路径) |
||||
* @property {String} shape 头像形状 ( circle (默认) | square) |
||||
* @property {String | Number} size 头像尺寸,可以为指定字符串(large, default, mini),或者数值 (默认 40 ) |
||||
* @property {String} mode 头像图片的裁剪类型,与uni的image组件的mode参数一致,如效果达不到需求,可尝试传widthFix值 (默认 'scaleToFill' ) |
||||
* @property {String} text 用文字替代图片,级别优先于src |
||||
* @property {String} bgColor 背景颜色,一般显示文字时用 (默认 '#c0c4cc' ) |
||||
* @property {String} color 文字颜色 (默认 '#ffffff' ) |
||||
* @property {String | Number} fontSize 文字大小 (默认 18 ) |
||||
* @property {String} icon 显示的图标 |
||||
* @property {Boolean} mpAvatar 显示小程序头像,只对百度,微信,QQ小程序有效 (默认 false ) |
||||
* @property {Boolean} randomBgColor 是否使用随机背景色 (默认 false ) |
||||
* @property {String} defaultUrl 加载失败的默认头像(组件有内置默认图片) |
||||
* @property {String | Number} colorIndex 如果配置了randomBgColor为true,且配置了此值,则从默认的背景色数组中取出对应索引的颜色值,取值0-19之间 |
||||
* @property {String} name 组件标识符 (默认 'level' ) |
||||
* @property {Object} customStyle 定义需要用到的外部样式 |
||||
* |
||||
* @event {Function} click 点击组件时触发 index: 用户传递的标识符 |
||||
* @example <u-avatar :src="src" mode="square"></u-avatar> |
||||
*/ |
||||
export default { |
||||
name: 'u-avatar', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
||||
data() { |
||||
return { |
||||
// 如果配置randomBgColor参数为true,在图标或者文字的模式下,会随机从中取出一个颜色值当做背景色 |
||||
colors: ['#ffb34b', '#f2bba9', '#f7a196', '#f18080', '#88a867', '#bfbf39', '#89c152', '#94d554', '#f19ec2', |
||||
'#afaae4', '#e1b0df', '#c38cc1', '#72dcdc', '#9acdcb', '#77b1cc', '#448aca', '#86cefa', '#98d1ee', |
||||
'#73d1f1', |
||||
'#80a7dc' |
||||
], |
||||
avatarUrl: this.src, |
||||
allowMp: false |
||||
} |
||||
}, |
||||
watch: { |
||||
// 监听头像src的变化,赋值给内部的avatarUrl变量,因为图片加载失败时,需要修改图片的src为默认值 |
||||
// 而组件内部不能直接修改props的值,所以需要一个中间变量 |
||||
src: { |
||||
immediate: true, |
||||
handler(newVal) { |
||||
this.avatarUrl = newVal |
||||
// 如果没有传src,则主动触发error事件,用于显示默认的头像,否则src为''空字符等的时候,会无内容展示 |
||||
if(!newVal) { |
||||
this.errorHandler() |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
imageStyle() { |
||||
const style = {} |
||||
return style |
||||
} |
||||
}, |
||||
created() { |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
init() { |
||||
// 目前只有这几个小程序平台具有open-data标签 |
||||
// 其他平台可以通过uni.getUserInfo类似接口获取信息,但是需要弹窗授权(首次),不合符组件逻辑 |
||||
// 故目前自动获取小程序头像只支持这几个平台 |
||||
// #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU |
||||
this.allowMp = true |
||||
// #endif |
||||
}, |
||||
// 判断传入的name属性,是否图片路径,只要带有"/"均认为是图片形式 |
||||
isImg() { |
||||
return this.src.indexOf('/') !== -1 |
||||
}, |
||||
// 图片加载时失败时触发 |
||||
errorHandler() { |
||||
this.avatarUrl = this.defaultUrl || base64Avatar |
||||
}, |
||||
clickHandler() { |
||||
this.$emit('click', this.name) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
.u-avatar { |
||||
@include flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
|
||||
&--circle { |
||||
border-radius: 100px; |
||||
} |
||||
|
||||
&--square { |
||||
border-radius: 4px; |
||||
} |
||||
|
||||
&__image { |
||||
&--circle { |
||||
border-radius: 100px; |
||||
} |
||||
|
||||
&--square { |
||||
border-radius: 4px; |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -1,54 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 返回顶部的形状,circle-圆形,square-方形
|
||||
mode: { |
||||
type: String, |
||||
default: uni.$u.props.backtop.mode |
||||
}, |
||||
// 自定义图标
|
||||
icon: { |
||||
type: String, |
||||
default: uni.$u.props.backtop.icon |
||||
}, |
||||
// 提示文字
|
||||
text: { |
||||
type: String, |
||||
default: uni.$u.props.backtop.text |
||||
}, |
||||
// 返回顶部滚动时间
|
||||
duration: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.backtop.duration |
||||
}, |
||||
// 滚动距离
|
||||
scrollTop: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.backtop.scrollTop |
||||
}, |
||||
// 距离顶部多少距离显示,单位px
|
||||
top: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.backtop.top |
||||
}, |
||||
// 返回顶部按钮到底部的距离,单位px
|
||||
bottom: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.backtop.bottom |
||||
}, |
||||
// 返回顶部按钮到右边的距离,单位px
|
||||
right: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.backtop.right |
||||
}, |
||||
// 层级
|
||||
zIndex: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.backtop.zIndex |
||||
}, |
||||
// 图标的样式,对象形式
|
||||
iconStyle: { |
||||
type: Object, |
||||
default: uni.$u.props.backtop.iconStyle |
||||
} |
||||
} |
||||
} |
@ -1,129 +0,0 @@
|
||||
<template> |
||||
<u-transition |
||||
mode="fade" |
||||
:customStyle="backTopStyle" |
||||
:show="show" |
||||
> |
||||
<view |
||||
class="u-back-top" |
||||
:style="[contentStyle]" |
||||
v-if="!$slots.default && !$slots.$default" |
||||
@click="backToTop" |
||||
> |
||||
<u-icon |
||||
:name="icon" |
||||
:custom-style="iconStyle" |
||||
></u-icon> |
||||
<text |
||||
v-if="text" |
||||
class="u-back-top__text" |
||||
>{{text}}</text> |
||||
</view> |
||||
<slot v-else /> |
||||
</u-transition> |
||||
</template> |
||||
|
||||
<script> |
||||
import props from './props.js'; |
||||
// #ifdef APP-NVUE |
||||
const dom = weex.requireModule('dom') |
||||
// #endif |
||||
/** |
||||
* backTop 返回顶部 |
||||
* @description 本组件一个用于长页面,滑动一定距离后,出现返回顶部按钮,方便快速返回顶部的场景。 |
||||
* @tutorial https://uviewui.com/components/backTop.html |
||||
* |
||||
* @property {String} mode 返回顶部的形状,circle-圆形,square-方形 (默认 'circle' ) |
||||
* @property {String} icon 自定义图标 (默认 'arrow-upward' ) 见官方文档示例 |
||||
* @property {String} text 提示文字 |
||||
* @property {String | Number} duration 返回顶部滚动时间 (默认 100) |
||||
* @property {String | Number} scrollTop 滚动距离 (默认 0 ) |
||||
* @property {String | Number} top 距离顶部多少距离显示,单位px (默认 400 ) |
||||
* @property {String | Number} bottom 返回顶部按钮到底部的距离,单位px (默认 100 ) |
||||
* @property {String | Number} right 返回顶部按钮到右边的距离,单位px (默认 20 ) |
||||
* @property {String | Number} zIndex 层级 (默认 9 ) |
||||
* @property {Object<Object>} iconStyle 图标的样式,对象形式 (默认 {color: '#909399',fontSize: '19px'}) |
||||
* @property {Object} customStyle 定义需要用到的外部样式 |
||||
* |
||||
* @example <u-back-top :scrollTop="scrollTop"></u-back-top> |
||||
*/ |
||||
export default { |
||||
name: 'u-back-top', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin,props], |
||||
computed: { |
||||
backTopStyle() { |
||||
// 动画组件样式 |
||||
const style = { |
||||
bottom: uni.$u.addUnit(this.bottom), |
||||
right: uni.$u.addUnit(this.right), |
||||
width: '40px', |
||||
height: '40px', |
||||
position: 'fixed', |
||||
zIndex: 10, |
||||
} |
||||
return style |
||||
}, |
||||
show() { |
||||
return uni.$u.getPx(this.scrollTop) > uni.$u.getPx(this.top) |
||||
}, |
||||
contentStyle() { |
||||
const style = {} |
||||
let radius = 0 |
||||
// 是否圆形 |
||||
if(this.mode === 'circle') { |
||||
radius = '100px' |
||||
} else { |
||||
radius = '4px' |
||||
} |
||||
// 为了兼容安卓nvue,只能这么分开写 |
||||
style.borderTopLeftRadius = radius |
||||
style.borderTopRightRadius = radius |
||||
style.borderBottomLeftRadius = radius |
||||
style.borderBottomRightRadius = radius |
||||
return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle)) |
||||
} |
||||
}, |
||||
methods: { |
||||
backToTop() { |
||||
// #ifdef APP-NVUE |
||||
if (!this.$parent.$refs['u-back-top']) { |
||||
uni.$u.error(`nvue页面需要给页面最外层元素设置"ref='u-back-top'`) |
||||
} |
||||
dom.scrollToElement(this.$parent.$refs['u-back-top'], { |
||||
offset: 0 |
||||
}) |
||||
// #endif |
||||
|
||||
// #ifndef APP-NVUE |
||||
uni.pageScrollTo({ |
||||
scrollTop: 0, |
||||
duration: this.duration |
||||
}); |
||||
// #endif |
||||
this.$emit('click') |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import '../../libs/css/components.scss'; |
||||
$u-back-top-flex:1 !default; |
||||
$u-back-top-height:100% !default; |
||||
$u-back-top-background-color:#E1E1E1 !default; |
||||
$u-back-top-tips-font-size:12px !default; |
||||
.u-back-top { |
||||
@include flex; |
||||
flex-direction: column; |
||||
align-items: center; |
||||
flex:$u-back-top-flex; |
||||
height: $u-back-top-height; |
||||
justify-content: center; |
||||
background-color: $u-back-top-background-color; |
||||
|
||||
&__tips { |
||||
font-size:$u-back-top-tips-font-size; |
||||
transform: scale(0.8); |
||||
} |
||||
} |
||||
</style> |
@ -1,72 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 是否显示圆点
|
||||
isDot: { |
||||
type: Boolean, |
||||
default: uni.$u.props.badge.isDot |
||||
}, |
||||
// 显示的内容
|
||||
value: { |
||||
type: [Number, String], |
||||
default: uni.$u.props.badge.value |
||||
}, |
||||
// 是否显示
|
||||
show: { |
||||
type: Boolean, |
||||
default: uni.$u.props.badge.show |
||||
}, |
||||
// 最大值,超过最大值会显示 '{max}+'
|
||||
max: { |
||||
type: [Number, String], |
||||
default: uni.$u.props.badge.max |
||||
}, |
||||
// 主题类型,error|warning|success|primary
|
||||
type: { |
||||
type: String, |
||||
default: uni.$u.props.badge.type |
||||
}, |
||||
// 当数值为 0 时,是否展示 Badge
|
||||
showZero: { |
||||
type: Boolean, |
||||
default: uni.$u.props.badge.showZero |
||||
}, |
||||
// 背景颜色,优先级比type高,如设置,type参数会失效
|
||||
bgColor: { |
||||
type: [String, null], |
||||
default: uni.$u.props.badge.bgColor |
||||
}, |
||||
// 字体颜色
|
||||
color: { |
||||
type: [String, null], |
||||
default: uni.$u.props.badge.color |
||||
}, |
||||
// 徽标形状,circle-四角均为圆角,horn-左下角为直角
|
||||
shape: { |
||||
type: String, |
||||
default: uni.$u.props.badge.shape |
||||
}, |
||||
// 设置数字的显示方式,overflow|ellipsis|limit
|
||||
// overflow会根据max字段判断,超出显示`${max}+`
|
||||
// ellipsis会根据max判断,超出显示`${max}...`
|
||||
// limit会依据1000作为判断条件,超出1000,显示`${value/1000}K`,比如2.2k、3.34w,最多保留2位小数
|
||||
numberType: { |
||||
type: String, |
||||
default: uni.$u.props.badge.numberType |
||||
}, |
||||
// 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效
|
||||
offset: { |
||||
type: Array, |
||||
default: uni.$u.props.badge.offset |
||||
}, |
||||
// 是否反转背景和字体颜色
|
||||
inverted: { |
||||
type: Boolean, |
||||
default: uni.$u.props.badge.inverted |
||||
}, |
||||
// 是否绝对定位
|
||||
absolute: { |
||||
type: Boolean, |
||||
default: uni.$u.props.badge.absolute |
||||
} |
||||
} |
||||
} |
@ -1,171 +0,0 @@
|
||||
<template> |
||||
<text |
||||
v-if="show && ((Number(value) === 0 ? showZero : true) || isDot)" |
||||
:class="[isDot ? 'u-badge--dot' : 'u-badge--not-dot', inverted && 'u-badge--inverted', shape === 'horn' && 'u-badge--horn', `u-badge--${type}${inverted ? '--inverted' : ''}`]" |
||||
:style="[$u.addStyle(customStyle), badgeStyle]" |
||||
class="u-badge" |
||||
>{{ isDot ? '' :showValue }}</text> |
||||
</template> |
||||
|
||||
<script> |
||||
import props from './props.js'; |
||||
/** |
||||
* badge 徽标数 |
||||
* @description 该组件一般用于图标右上角显示未读的消息数量,提示用户点击,有圆点和圆包含文字两种形式。 |
||||
* @tutorial https://uviewui.com/components/badge.html |
||||
* |
||||
* @property {Boolean} isDot 是否显示圆点 (默认 false ) |
||||
* @property {String | Number} value 显示的内容 |
||||
* @property {Boolean} show 是否显示 (默认 true ) |
||||
* @property {String | Number} max 最大值,超过最大值会显示 '{max}+' (默认999) |
||||
* @property {String} type 主题类型,error|warning|success|primary (默认 'error' ) |
||||
* @property {Boolean} showZero 当数值为 0 时,是否展示 Badge (默认 false ) |
||||
* @property {String} bgColor 背景颜色,优先级比type高,如设置,type参数会失效 |
||||
* @property {String} color 字体颜色 (默认 '#ffffff' ) |
||||
* @property {String} shape 徽标形状,circle-四角均为圆角,horn-左下角为直角 (默认 'circle' ) |
||||
* @property {String} numberType 设置数字的显示方式,overflow|ellipsis|limit (默认 'overflow' ) |
||||
* @property {Array}} offset 设置badge的位置偏移,格式为 [x, y],也即设置的为top和right的值,absolute为true时有效 |
||||
* @property {Boolean} inverted 是否反转背景和字体颜色(默认 false ) |
||||
* @property {Boolean} absolute 是否绝对定位(默认 false ) |
||||
* @property {Object} customStyle 定义需要用到的外部样式 |
||||
* @example <u-badge :type="type" :count="count"></u-badge> |
||||
*/ |
||||
export default { |
||||
name: 'u-badge', |
||||
mixins: [uni.$u.mpMixin, props, uni.$u.mixin], |
||||
computed: { |
||||
// 是否将badge中心与父组件右上角重合 |
||||
boxStyle() { |
||||
let style = {}; |
||||
return style; |
||||
}, |
||||
// 整个组件的样式 |
||||
badgeStyle() { |
||||
const style = {} |
||||
if(this.color) { |
||||
style.color = this.color |
||||
} |
||||
if (this.bgColor && !this.inverted) { |
||||
style.backgroundColor = this.bgColor |
||||
} |
||||
if (this.absolute) { |
||||
style.position = 'absolute' |
||||
// 如果有设置offset参数 |
||||
if(this.offset.length) { |
||||
// top和right分为为offset的第一个和第二个值,如果没有第二个值,则right等于top |
||||
const top = this.offset[0] |
||||
const right = this.offset[1] || top |
||||
style.top = uni.$u.addUnit(top) |
||||
style.right = uni.$u.addUnit(right) |
||||
} |
||||
} |
||||
return style |
||||
}, |
||||
showValue() { |
||||
switch (this.numberType) { |
||||
case "overflow": |
||||
return Number(this.value) > Number(this.max) ? this.max + "+" : this.value |
||||
break; |
||||
case "ellipsis": |
||||
return Number(this.value) > Number(this.max) ? "..." : this.value |
||||
break; |
||||
case "limit": |
||||
return Number(this.value) > 999 ? Number(this.value) >= 9999 ? |
||||
Math.floor(this.value / 1e4 * 100) / 100 + "w" : Math.floor(this.value / |
||||
1e3 * 100) / 100 + "k" : this.value |
||||
break; |
||||
default: |
||||
return Number(this.value) |
||||
} |
||||
}, |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
$u-badge-primary: $u-primary !default; |
||||
$u-badge-error: $u-error !default; |
||||
$u-badge-success: $u-success !default; |
||||
$u-badge-info: $u-info !default; |
||||
$u-badge-warning: $u-warning !default; |
||||
$u-badge-dot-radius: 100px !default; |
||||
$u-badge-dot-size: 8px !default; |
||||
$u-badge-dot-right: 4px !default; |
||||
$u-badge-dot-top: 0 !default; |
||||
$u-badge-text-font-size: 11px !default; |
||||
$u-badge-text-right: 10px !default; |
||||
$u-badge-text-padding: 2px 5px !default; |
||||
$u-badge-text-align: center !default; |
||||
$u-badge-text-color: #FFFFFF !default; |
||||
|
||||
.u-badge { |
||||
border-top-right-radius: $u-badge-dot-radius; |
||||
border-top-left-radius: $u-badge-dot-radius; |
||||
border-bottom-left-radius: $u-badge-dot-radius; |
||||
border-bottom-right-radius: $u-badge-dot-radius; |
||||
@include flex; |
||||
line-height: $u-badge-text-font-size; |
||||
text-align: $u-badge-text-align; |
||||
font-size: $u-badge-text-font-size; |
||||
color: $u-badge-text-color; |
||||
|
||||
&--dot { |
||||
height: $u-badge-dot-size; |
||||
width: $u-badge-dot-size; |
||||
} |
||||
|
||||
&--inverted { |
||||
font-size: 13px; |
||||
} |
||||
|
||||
&--not-dot { |
||||
padding: $u-badge-text-padding; |
||||
} |
||||
|
||||
&--horn { |
||||
border-bottom-left-radius: 0; |
||||
} |
||||
|
||||
&--primary { |
||||
background-color: $u-badge-primary; |
||||
} |
||||
|
||||
&--primary--inverted { |
||||
color: $u-badge-primary; |
||||
} |
||||
|
||||
&--error { |
||||
background-color: $u-badge-error; |
||||
} |
||||
|
||||
&--error--inverted { |
||||
color: $u-badge-error; |
||||
} |
||||
|
||||
&--success { |
||||
background-color: $u-badge-success; |
||||
} |
||||
|
||||
&--success--inverted { |
||||
color: $u-badge-success; |
||||
} |
||||
|
||||
&--info { |
||||
background-color: $u-badge-info; |
||||
} |
||||
|
||||
&--info--inverted { |
||||
color: $u-badge-info; |
||||
} |
||||
|
||||
&--warning { |
||||
background-color: $u-badge-warning; |
||||
} |
||||
|
||||
&--warning--inverted { |
||||
color: $u-badge-warning; |
||||
} |
||||
} |
||||
</style> |
@ -1,46 +0,0 @@
|
||||
$u-button-active-opacity:0.75 !default; |
||||
$u-button-loading-text-margin-left:4px !default; |
||||
$u-button-text-color: #FFFFFF !default; |
||||
$u-button-text-plain-error-color:$u-error !default; |
||||
$u-button-text-plain-warning-color:$u-warning !default; |
||||
$u-button-text-plain-success-color:$u-success !default; |
||||
$u-button-text-plain-info-color:$u-info !default; |
||||
$u-button-text-plain-primary-color:$u-primary !default; |
||||
.u-button { |
||||
&--active { |
||||
opacity: $u-button-active-opacity; |
||||
} |
||||
|
||||
&--active--plain { |
||||
background-color: rgb(217, 217, 217); |
||||
} |
||||
|
||||
&__loading-text { |
||||
margin-left:$u-button-loading-text-margin-left; |
||||
} |
||||
|
||||
&__text, |
||||
&__loading-text { |
||||
color:$u-button-text-color; |
||||
} |
||||
|
||||
&__text--plain--error { |
||||
color:$u-button-text-plain-error-color; |
||||
} |
||||
|
||||
&__text--plain--warning { |
||||
color:$u-button-text-plain-warning-color; |
||||
} |
||||
|
||||
&__text--plain--success{ |
||||
color:$u-button-text-plain-success-color; |
||||
} |
||||
|
||||
&__text--plain--info { |
||||
color:$u-button-text-plain-info-color; |
||||
} |
||||
|
||||
&__text--plain--primary { |
||||
color:$u-button-text-plain-primary-color; |
||||
} |
||||
} |
@ -1,161 +0,0 @@
|
||||
/* |
||||
* @Author : LQ |
||||
* @Description : |
||||
* @version : 1.0 |
||||
* @Date : 2021-08-16 10:04:04 |
||||
* @LastAuthor : LQ |
||||
* @lastTime : 2021-08-16 10:04:24 |
||||
* @FilePath : /u-view2.0/uview-ui/components/u-button/props.js |
||||
*/ |
||||
export default { |
||||
props: { |
||||
// 是否细边框
|
||||
hairline: { |
||||
type: Boolean, |
||||
default: uni.$u.props.button.hairline |
||||
}, |
||||
// 按钮的预置样式,info,primary,error,warning,success
|
||||
type: { |
||||
type: String, |
||||
default: uni.$u.props.button.type |
||||
}, |
||||
// 按钮尺寸,large,normal,small,mini
|
||||
size: { |
||||
type: String, |
||||
default: uni.$u.props.button.size |
||||
}, |
||||
// 按钮形状,circle(两边为半圆),square(带圆角)
|
||||
shape: { |
||||
type: String, |
||||
default: uni.$u.props.button.shape |
||||
}, |
||||
// 按钮是否镂空
|
||||
plain: { |
||||
type: Boolean, |
||||
default: uni.$u.props.button.plain |
||||
}, |
||||
// 是否禁止状态
|
||||
disabled: { |
||||
type: Boolean, |
||||
default: uni.$u.props.button.disabled |
||||
}, |
||||
// 是否加载中
|
||||
loading: { |
||||
type: Boolean, |
||||
default: uni.$u.props.button.loading |
||||
}, |
||||
// 加载中提示文字
|
||||
loadingText: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.button.loadingText |
||||
}, |
||||
// 加载状态图标类型
|
||||
loadingMode: { |
||||
type: String, |
||||
default: uni.$u.props.button.loadingMode |
||||
}, |
||||
// 加载图标大小
|
||||
loadingSize: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.button.loadingSize |
||||
}, |
||||
// 开放能力,具体请看uniapp稳定关于button组件部分说明
|
||||
// https://uniapp.dcloud.io/component/button
|
||||
openType: { |
||||
type: String, |
||||
default: uni.$u.props.button.openType |
||||
}, |
||||
// 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件
|
||||
// 取值为submit(提交表单),reset(重置表单)
|
||||
formType: { |
||||
type: String, |
||||
default: uni.$u.props.button.formType |
||||
}, |
||||
// 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效
|
||||
// 只微信小程序、QQ小程序有效
|
||||
appParameter: { |
||||
type: String, |
||||
default: uni.$u.props.button.appParameter |
||||
}, |
||||
// 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效
|
||||
hoverStopPropagation: { |
||||
type: Boolean, |
||||
default: uni.$u.props.button.hoverStopPropagation |
||||
}, |
||||
// 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文。只微信小程序有效
|
||||
lang: { |
||||
type: String, |
||||
default: uni.$u.props.button.lang |
||||
}, |
||||
// 会话来源,open-type="contact"时有效。只微信小程序有效
|
||||
sessionFrom: { |
||||
type: String, |
||||
default: uni.$u.props.button.sessionFrom |
||||
}, |
||||
// 会话内消息卡片标题,open-type="contact"时有效
|
||||
// 默认当前标题,只微信小程序有效
|
||||
sendMessageTitle: { |
||||
type: String, |
||||
default: uni.$u.props.button.sendMessageTitle |
||||
}, |
||||
// 会话内消息卡片点击跳转小程序路径,open-type="contact"时有效
|
||||
// 默认当前分享路径,只微信小程序有效
|
||||
sendMessagePath: { |
||||
type: String, |
||||
default: uni.$u.props.button.sendMessagePath |
||||
}, |
||||
// 会话内消息卡片图片,open-type="contact"时有效
|
||||
// 默认当前页面截图,只微信小程序有效
|
||||
sendMessageImg: { |
||||
type: String, |
||||
default: uni.$u.props.button.sendMessageImg |
||||
}, |
||||
// 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,
|
||||
// 用户点击后可以快速发送小程序消息,open-type="contact"时有效
|
||||
showMessageCard: { |
||||
type: Boolean, |
||||
default: uni.$u.props.button.showMessageCard |
||||
}, |
||||
// 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取
|
||||
dataName: { |
||||
type: String, |
||||
default: uni.$u.props.button.dataName |
||||
}, |
||||
// 节流,一定时间内只能触发一次
|
||||
throttleTime: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.button.throttleTime |
||||
}, |
||||
// 按住后多久出现点击态,单位毫秒
|
||||
hoverStartTime: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.button.hoverStartTime |
||||
}, |
||||
// 手指松开后点击态保留时间,单位毫秒
|
||||
hoverStayTime: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.button.hoverStayTime |
||||
}, |
||||
// 按钮文字,之所以通过props传入,是因为slot传入的话
|
||||
// nvue中无法控制文字的样式
|
||||
text: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.button.text |
||||
}, |
||||
// 按钮图标
|
||||
icon: { |
||||
type: String, |
||||
default: uni.$u.props.button.icon |
||||
}, |
||||
// 按钮图标
|
||||
iconColor: { |
||||
type: String, |
||||
default: uni.$u.props.button.icon |
||||
}, |
||||
// 按钮颜色,支持传入linear-gradient渐变色
|
||||
color: { |
||||
type: String, |
||||
default: uni.$u.props.button.color |
||||
} |
||||
} |
||||
} |
@ -1,490 +0,0 @@
|
||||
<template> |
||||
<!-- #ifndef APP-NVUE --> |
||||
<button |
||||
:hover-start-time="Number(hoverStartTime)" |
||||
:hover-stay-time="Number(hoverStayTime)" |
||||
:form-type="formType" |
||||
:open-type="openType" |
||||
:app-parameter="appParameter" |
||||
:hover-stop-propagation="hoverStopPropagation" |
||||
:send-message-title="sendMessageTitle" |
||||
:send-message-path="sendMessagePath" |
||||
:lang="lang" |
||||
:data-name="dataName" |
||||
:session-from="sessionFrom" |
||||
:send-message-img="sendMessageImg" |
||||
:show-message-card="showMessageCard" |
||||
@getphonenumber="getphonenumber" |
||||
@getuserinfo="getuserinfo" |
||||
@error="error" |
||||
@opensetting="opensetting" |
||||
@launchapp="launchapp" |
||||
:hover-class="!disabled && !loading ? 'u-button--active' : ''" |
||||
class="u-button u-reset-button" |
||||
:style="[baseColor, $u.addStyle(customStyle)]" |
||||
@tap="clickHandler" |
||||
:class="bemClass" |
||||
> |
||||
<template v-if="loading"> |
||||
<u-loading-icon |
||||
:mode="loadingMode" |
||||
:size="loadingSize * 1.15" |
||||
:color="loadingColor" |
||||
></u-loading-icon> |
||||
<text |
||||
class="u-button__loading-text" |
||||
:style="[{ fontSize: textSize + 'px' }]" |
||||
>{{ loadingText || text }}</text |
||||
> |
||||
</template> |
||||
<template v-else> |
||||
<u-icon |
||||
v-if="icon" |
||||
:name="icon" |
||||
:color="iconColorCom" |
||||
:size="textSize * 1.35" |
||||
:customStyle="{ marginRight: '2px' }" |
||||
></u-icon> |
||||
<slot> |
||||
<text |
||||
class="u-button__text" |
||||
:style="[{ fontSize: textSize + 'px' }]" |
||||
>{{ text }}</text |
||||
> |
||||
</slot> |
||||
</template> |
||||
</button> |
||||
<!-- #endif --> |
||||
|
||||
<!-- #ifdef APP-NVUE --> |
||||
<view |
||||
:hover-start-time="Number(hoverStartTime)" |
||||
:hover-stay-time="Number(hoverStayTime)" |
||||
class="u-button" |
||||
:hover-class=" |
||||
!disabled && !loading && !color && (plain || type === 'info') |
||||
? 'u-button--active--plain' |
||||
: !disabled && !loading && !plain |
||||
? 'u-button--active' |
||||
: '' |
||||
" |
||||
@tap="clickHandler" |
||||
:class="bemClass" |
||||
:style="[baseColor, $u.addStyle(customStyle)]" |
||||
> |
||||
<template v-if="loading"> |
||||
<u-loading-icon |
||||
:mode="loadingMode" |
||||
:size="loadingSize * 1.15" |
||||
:color="loadingColor" |
||||
></u-loading-icon> |
||||
<text |
||||
class="u-button__loading-text" |
||||
:style="[nvueTextStyle]" |
||||
:class="[plain && `u-button__text--plain--${type}`]" |
||||
>{{ loadingText || text }}</text |
||||
> |
||||
</template> |
||||
<template v-else> |
||||
<u-icon |
||||
v-if="icon" |
||||
:name="icon" |
||||
:color="iconColorCom" |
||||
:size="textSize * 1.35" |
||||
></u-icon> |
||||
<text |
||||
class="u-button__text" |
||||
:style="[ |
||||
{ |
||||
marginLeft: icon ? '2px' : 0, |
||||
}, |
||||
nvueTextStyle, |
||||
]" |
||||
:class="[plain && `u-button__text--plain--${type}`]" |
||||
>{{ text }}</text |
||||
> |
||||
</template> |
||||
</view> |
||||
<!-- #endif --> |
||||
</template> |
||||
|
||||
<script> |
||||
import button from "../../libs/mixin/button.js"; |
||||
import openType from "../../libs/mixin/openType.js"; |
||||
import props from "./props.js"; |
||||
/** |
||||
* button 按钮 |
||||
* @description Button 按钮 |
||||
* @tutorial https://www.uviewui.com/components/button.html |
||||
* |
||||
* @property {Boolean} hairline 是否显示按钮的细边框 (默认 true ) |
||||
* @property {String} type 按钮的预置样式,info,primary,error,warning,success (默认 'info' ) |
||||
* @property {String} size 按钮尺寸,large,normal,mini (默认 normal) |
||||
* @property {String} shape 按钮形状,circle(两边为半圆),square(带圆角) (默认 'square' ) |
||||
* @property {Boolean} plain 按钮是否镂空,背景色透明 (默认 false) |
||||
* @property {Boolean} disabled 是否禁用 (默认 false) |
||||
* @property {Boolean} loading 按钮名称前是否带 loading 图标(App-nvue 平台,在 ios 上为雪花,Android上为圆圈) (默认 false) |
||||
* @property {String | Number} loadingText 加载中提示文字 |
||||
* @property {String} loadingMode 加载状态图标类型 (默认 'spinner' ) |
||||
* @property {String | Number} loadingSize 加载图标大小 (默认 15 ) |
||||
* @property {String} openType 开放能力,具体请看uniapp稳定关于button组件部分说明 |
||||
* @property {String} formType 用于 <form> 组件,点击分别会触发 <form> 组件的 submit/reset 事件 |
||||
* @property {String} appParameter 打开 APP 时,向 APP 传递的参数,open-type=launchApp时有效 (注:只微信小程序、QQ小程序有效) |
||||
* @property {Boolean} hoverStopPropagation 指定是否阻止本节点的祖先节点出现点击态,微信小程序有效(默认 true ) |
||||
* @property {String} lang 指定返回用户信息的语言,zh_CN 简体中文,zh_TW 繁体中文,en 英文(默认 en ) |
||||
* @property {String} sessionFrom 会话来源,openType="contact"时有效 |
||||
* @property {String} sendMessageTitle 会话内消息卡片标题,openType="contact"时有效 |
||||
* @property {String} sendMessagePath 会话内消息卡片点击跳转小程序路径,openType="contact"时有效 |
||||
* @property {String} sendMessageImg 会话内消息卡片图片,openType="contact"时有效 |
||||
* @property {Boolean} showMessageCard 是否显示会话内消息卡片,设置此参数为 true,用户进入客服会话会在右下角显示"可能要发送的小程序"提示,用户点击后可以快速发送小程序消息,openType="contact"时有效(默认false) |
||||
* @property {String} dataName 额外传参参数,用于小程序的data-xxx属性,通过target.dataset.name获取 |
||||
* @property {String | Number} throttleTime 节流,一定时间内只能触发一次 (默认 0 ) |
||||
* @property {String | Number} hoverStartTime 按住后多久出现点击态,单位毫秒 (默认 0 ) |
||||
* @property {String | Number} hoverStayTime 手指松开后点击态保留时间,单位毫秒 (默认 200 ) |
||||
* @property {String | Number} text 按钮文字,之所以通过props传入,是因为slot传入的话(注:nvue中无法控制文字的样式) |
||||
* @property {String} icon 按钮图标 |
||||
* @property {String} iconColor 按钮图标颜色 |
||||
* @property {String} color 按钮颜色,支持传入linear-gradient渐变色 |
||||
* @property {Object} customStyle 定义需要用到的外部样式 |
||||
* |
||||
* @event {Function} click 非禁止并且非加载中,才能点击 |
||||
* @event {Function} getphonenumber open-type="getPhoneNumber"时有效 |
||||
* @event {Function} getuserinfo 用户点击该按钮时,会返回获取到的用户信息,从返回参数的detail中获取到的值同uni.getUserInfo |
||||
* @event {Function} error 当使用开放能力时,发生错误的回调 |
||||
* @event {Function} opensetting 在打开授权设置页并关闭后回调 |
||||
* @event {Function} launchapp 打开 APP 成功的回调 |
||||
* @example <u-button>月落</u-button> |
||||
*/ |
||||
export default { |
||||
name: "u-button", |
||||
// #ifdef MP |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, button, openType, props], |
||||
// #endif |
||||
// #ifndef MP |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
||||
// #endif |
||||
data() { |
||||
return {}; |
||||
}, |
||||
computed: { |
||||
// 生成bem风格的类名 |
||||
bemClass() { |
||||
// this.bem为一个computed变量,在mixin中 |
||||
if (!this.color) { |
||||
return this.bem( |
||||
"button", |
||||
["type", "shape", "size"], |
||||
["disabled", "plain", "hairline"] |
||||
); |
||||
} else { |
||||
// 由于nvue的原因,在有color参数时,不需要传入type,否则会生成type相关的类型,影响最终的样式 |
||||
return this.bem( |
||||
"button", |
||||
["shape", "size"], |
||||
["disabled", "plain", "hairline"] |
||||
); |
||||
} |
||||
}, |
||||
loadingColor() { |
||||
if (this.plain) { |
||||
// 如果有设置color值,则用color值,否则使用type主题颜色 |
||||
return this.color |
||||
? this.color |
||||
: uni.$u.config.color[`u-${this.type}`]; |
||||
} |
||||
if (this.type === "info") { |
||||
return "#c9c9c9"; |
||||
} |
||||
return "rgb(200, 200, 200)"; |
||||
}, |
||||
iconColorCom() { |
||||
// 如果是镂空状态,设置了color就用color值,否则使用主题颜色, |
||||
// u-icon的color能接受一个主题颜色的值 |
||||
if (this.iconColor) return this.iconColor; |
||||
if (this.plain) { |
||||
return this.color ? this.color : this.type; |
||||
} else { |
||||
return this.type === "info" ? "#000000" : "#ffffff"; |
||||
} |
||||
}, |
||||
baseColor() { |
||||
let style = {}; |
||||
if (this.color) { |
||||
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色 |
||||
style.color = this.plain ? this.color : "white"; |
||||
if (!this.plain) { |
||||
// 非镂空,背景色使用自定义的颜色 |
||||
style["background-color"] = this.color; |
||||
} |
||||
if (this.color.indexOf("gradient") !== -1) { |
||||
// 如果自定义的颜色为渐变色,不显示边框,以及通过backgroundImage设置渐变色 |
||||
// weex文档说明可以写borderWidth的形式,为什么这里需要分开写? |
||||
// 因为weex是阿里巴巴为了部门业绩考核而做的你懂的东西,所以需要这么写才有效 |
||||
style.borderTopWidth = 0; |
||||
style.borderRightWidth = 0; |
||||
style.borderBottomWidth = 0; |
||||
style.borderLeftWidth = 0; |
||||
if (!this.plain) { |
||||
style.backgroundImage = this.color; |
||||
} |
||||
} else { |
||||
// 非渐变色,则设置边框相关的属性 |
||||
style.borderColor = this.color; |
||||
style.borderWidth = "1px"; |
||||
style.borderStyle = "solid"; |
||||
} |
||||
} |
||||
return style; |
||||
}, |
||||
// nvue版本按钮的字体不会继承父组件的颜色,需要对每一个text组件进行单独的设置 |
||||
nvueTextStyle() { |
||||
let style = {}; |
||||
// 针对自定义了color颜色的情况,镂空状态下,就是用自定义的颜色 |
||||
if (this.type === "info") { |
||||
style.color = "#323233"; |
||||
} |
||||
if (this.color) { |
||||
style.color = this.plain ? this.color : "white"; |
||||
} |
||||
style.fontSize = this.textSize + "px"; |
||||
return style; |
||||
}, |
||||
// 字体大小 |
||||
textSize() { |
||||
let fontSize = 14, |
||||
{ size } = this; |
||||
if (size === "large") fontSize = 16; |
||||
if (size === "normal") fontSize = 14; |
||||
if (size === "small") fontSize = 12; |
||||
if (size === "mini") fontSize = 10; |
||||
return fontSize; |
||||
}, |
||||
}, |
||||
methods: { |
||||
clickHandler() { |
||||
// 非禁止并且非加载中,才能点击 |
||||
if (!this.disabled && !this.loading) { |
||||
// 进行节流控制,每this.throttle毫秒内,只在开始处执行 |
||||
uni.$u.throttle(() => { |
||||
this.$emit("click"); |
||||
}, this.throttleTime); |
||||
} |
||||
}, |
||||
// 下面为对接uniapp官方按钮开放能力事件回调的对接 |
||||
getphonenumber(res) { |
||||
this.$emit("getphonenumber", res); |
||||
}, |
||||
getuserinfo(res) { |
||||
this.$emit("getuserinfo", res); |
||||
}, |
||||
error(res) { |
||||
this.$emit("error", res); |
||||
}, |
||||
opensetting(res) { |
||||
this.$emit("opensetting", res); |
||||
}, |
||||
launchapp(res) { |
||||
this.$emit("launchapp", res); |
||||
}, |
||||
}, |
||||
}; |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
/* #ifndef APP-NVUE */ |
||||
@import "./vue.scss"; |
||||
/* #endif */ |
||||
|
||||
/* #ifdef APP-NVUE */ |
||||
@import "./nvue.scss"; |
||||
/* #endif */ |
||||
|
||||
$u-button-u-button-height: 40px !default; |
||||
$u-button-text-font-size: 15px !default; |
||||
$u-button-loading-text-font-size: 15px !default; |
||||
$u-button-loading-text-margin-left: 4px !default; |
||||
$u-button-large-width: 100% !default; |
||||
$u-button-large-height: 50px !default; |
||||
$u-button-normal-padding: 0 12px !default; |
||||
$u-button-large-padding: 0 15px !default; |
||||
$u-button-normal-font-size: 14px !default; |
||||
$u-button-small-min-width: 60px !default; |
||||
$u-button-small-height: 30px !default; |
||||
$u-button-small-padding: 0px 8px !default; |
||||
$u-button-mini-padding: 0px 8px !default; |
||||
$u-button-small-font-size: 12px !default; |
||||
$u-button-mini-height: 22px !default; |
||||
$u-button-mini-font-size: 10px !default; |
||||
$u-button-mini-min-width: 50px !default; |
||||
$u-button-disabled-opacity: 0.5 !default; |
||||
$u-button-info-color: #323233 !default; |
||||
$u-button-info-background-color: #fff !default; |
||||
$u-button-info-border-color: #ebedf0 !default; |
||||
$u-button-info-border-width: 1px !default; |
||||
$u-button-info-border-style: solid !default; |
||||
$u-button-success-color: #fff !default; |
||||
$u-button-success-background-color: $u-success !default; |
||||
$u-button-success-border-color: $u-button-success-background-color !default; |
||||
$u-button-success-border-width: 1px !default; |
||||
$u-button-success-border-style: solid !default; |
||||
$u-button-primary-color: #fff !default; |
||||
$u-button-primary-background-color: $u-primary !default; |
||||
$u-button-primary-border-color: $u-button-primary-background-color !default; |
||||
$u-button-primary-border-width: 1px !default; |
||||
$u-button-primary-border-style: solid !default; |
||||
$u-button-error-color: #fff !default; |
||||
$u-button-error-background-color: $u-error !default; |
||||
$u-button-error-border-color: $u-button-error-background-color !default; |
||||
$u-button-error-border-width: 1px !default; |
||||
$u-button-error-border-style: solid !default; |
||||
$u-button-warning-color: #fff !default; |
||||
$u-button-warning-background-color: $u-warning !default; |
||||
$u-button-warning-border-color: $u-button-warning-background-color !default; |
||||
$u-button-warning-border-width: 1px !default; |
||||
$u-button-warning-border-style: solid !default; |
||||
$u-button-block-width: 100% !default; |
||||
$u-button-circle-border-top-right-radius: 100px !default; |
||||
$u-button-circle-border-top-left-radius: 100px !default; |
||||
$u-button-circle-border-bottom-left-radius: 100px !default; |
||||
$u-button-circle-border-bottom-right-radius: 100px !default; |
||||
$u-button-square-border-top-right-radius: 3px !default; |
||||
$u-button-square-border-top-left-radius: 3px !default; |
||||
$u-button-square-border-bottom-left-radius: 3px !default; |
||||
$u-button-square-border-bottom-right-radius: 3px !default; |
||||
$u-button-icon-min-width: 1em !default; |
||||
$u-button-plain-background-color: #fff !default; |
||||
$u-button-hairline-border-width: 0.5px !default; |
||||
|
||||
.u-button { |
||||
height: $u-button-u-button-height; |
||||
position: relative; |
||||
align-items: center; |
||||
justify-content: center; |
||||
@include flex; |
||||
/* #ifndef APP-NVUE */ |
||||
box-sizing: border-box; |
||||
/* #endif */ |
||||
flex-direction: row; |
||||
|
||||
&__text { |
||||
font-size: $u-button-text-font-size; |
||||
} |
||||
|
||||
&__loading-text { |
||||
font-size: $u-button-loading-text-font-size; |
||||
margin-left: $u-button-loading-text-margin-left; |
||||
} |
||||
|
||||
&--large { |
||||
/* #ifndef APP-NVUE */ |
||||
width: $u-button-large-width; |
||||
/* #endif */ |
||||
height: $u-button-large-height; |
||||
padding: $u-button-large-padding; |
||||
} |
||||
|
||||
&--normal { |
||||
padding: $u-button-normal-padding; |
||||
font-size: $u-button-normal-font-size; |
||||
} |
||||
|
||||
&--small { |
||||
/* #ifndef APP-NVUE */ |
||||
min-width: $u-button-small-min-width; |
||||
/* #endif */ |
||||
height: $u-button-small-height; |
||||
padding: $u-button-small-padding; |
||||
font-size: $u-button-small-font-size; |
||||
} |
||||
|
||||
&--mini { |
||||
height: $u-button-mini-height; |
||||
font-size: $u-button-mini-font-size; |
||||
/* #ifndef APP-NVUE */ |
||||
min-width: $u-button-mini-min-width; |
||||
/* #endif */ |
||||
padding: $u-button-mini-padding; |
||||
} |
||||
|
||||
&--disabled { |
||||
opacity: $u-button-disabled-opacity; |
||||
} |
||||
|
||||
&--info { |
||||
color: $u-button-info-color; |
||||
background-color: $u-button-info-background-color; |
||||
border-color: $u-button-info-border-color; |
||||
border-width: $u-button-info-border-width; |
||||
border-style: $u-button-info-border-style; |
||||
} |
||||
|
||||
&--success { |
||||
color: $u-button-success-color; |
||||
background-color: $u-button-success-background-color; |
||||
border-color: $u-button-success-border-color; |
||||
border-width: $u-button-success-border-width; |
||||
border-style: $u-button-success-border-style; |
||||
} |
||||
|
||||
&--primary { |
||||
color: $u-button-primary-color; |
||||
background-color: $u-button-primary-background-color; |
||||
border-color: $u-button-primary-border-color; |
||||
border-width: $u-button-primary-border-width; |
||||
border-style: $u-button-primary-border-style; |
||||
} |
||||
|
||||
&--error { |
||||
color: $u-button-error-color; |
||||
background-color: $u-button-error-background-color; |
||||
border-color: $u-button-error-border-color; |
||||
border-width: $u-button-error-border-width; |
||||
border-style: $u-button-error-border-style; |
||||
} |
||||
|
||||
&--warning { |
||||
color: $u-button-warning-color; |
||||
background-color: $u-button-warning-background-color; |
||||
border-color: $u-button-warning-border-color; |
||||
border-width: $u-button-warning-border-width; |
||||
border-style: $u-button-warning-border-style; |
||||
} |
||||
|
||||
&--block { |
||||
@include flex; |
||||
width: $u-button-block-width; |
||||
} |
||||
|
||||
&--circle { |
||||
border-top-right-radius: $u-button-circle-border-top-right-radius; |
||||
border-top-left-radius: $u-button-circle-border-top-left-radius; |
||||
border-bottom-left-radius: $u-button-circle-border-bottom-left-radius; |
||||
border-bottom-right-radius: $u-button-circle-border-bottom-right-radius; |
||||
} |
||||
|
||||
&--square { |
||||
border-bottom-left-radius: $u-button-square-border-top-right-radius; |
||||
border-bottom-right-radius: $u-button-square-border-top-left-radius; |
||||
border-top-left-radius: $u-button-square-border-bottom-left-radius; |
||||
border-top-right-radius: $u-button-square-border-bottom-right-radius; |
||||
} |
||||
|
||||
&__icon { |
||||
/* #ifndef APP-NVUE */ |
||||
min-width: $u-button-icon-min-width; |
||||
line-height: inherit !important; |
||||
vertical-align: top; |
||||
/* #endif */ |
||||
} |
||||
|
||||
&--plain { |
||||
background-color: $u-button-plain-background-color; |
||||
} |
||||
|
||||
&--hairline { |
||||
border-width: $u-button-hairline-border-width !important; |
||||
} |
||||
} |
||||
</style> |
@ -1,80 +0,0 @@
|
||||
// nvue下hover-class无效 |
||||
$u-button-before-top:50% !default; |
||||
$u-button-before-left:50% !default; |
||||
$u-button-before-width:100% !default; |
||||
$u-button-before-height:100% !default; |
||||
$u-button-before-transform:translate(-50%, -50%) !default; |
||||
$u-button-before-opacity:0 !default; |
||||
$u-button-before-background-color:#000 !default; |
||||
$u-button-before-border-color:#000 !default; |
||||
$u-button-active-before-opacity:.15 !default; |
||||
$u-button-icon-margin-left:4px !default; |
||||
$u-button-plain-u-button-info-color:$u-info; |
||||
$u-button-plain-u-button-success-color:$u-success; |
||||
$u-button-plain-u-button-error-color:$u-error; |
||||
$u-button-plain-u-button-warning-color:$u-error; |
||||
|
||||
.u-button { |
||||
width: 100%; |
||||
|
||||
&__text { |
||||
white-space: nowrap; |
||||
line-height: 1; |
||||
} |
||||
|
||||
&:before { |
||||
position: absolute; |
||||
top:$u-button-before-top; |
||||
left:$u-button-before-left; |
||||
width:$u-button-before-width; |
||||
height:$u-button-before-height; |
||||
border: inherit; |
||||
border-radius: inherit; |
||||
transform:$u-button-before-transform; |
||||
opacity:$u-button-before-opacity; |
||||
content: " "; |
||||
background-color:$u-button-before-background-color; |
||||
border-color:$u-button-before-border-color; |
||||
} |
||||
|
||||
&--active { |
||||
&:before { |
||||
opacity: .15 |
||||
} |
||||
} |
||||
|
||||
&__icon+&__text:not(:empty), |
||||
&__loading-text { |
||||
margin-left:$u-button-icon-margin-left; |
||||
} |
||||
|
||||
&--plain { |
||||
&.u-button--primary { |
||||
color: $u-primary; |
||||
} |
||||
} |
||||
|
||||
&--plain { |
||||
&.u-button--info { |
||||
color:$u-button-plain-u-button-info-color; |
||||
} |
||||
} |
||||
|
||||
&--plain { |
||||
&.u-button--success { |
||||
color:$u-button-plain-u-button-success-color; |
||||
} |
||||
} |
||||
|
||||
&--plain { |
||||
&.u-button--error { |
||||
color:$u-button-plain-u-button-error-color; |
||||
} |
||||
} |
||||
|
||||
&--plain { |
||||
&.u-button--warning { |
||||
color:$u-button-plain-u-button-warning-color; |
||||
} |
||||
} |
||||
} |
@ -1,99 +0,0 @@
|
||||
<template> |
||||
<view class="u-calendar-header u-border-bottom"> |
||||
<text |
||||
class="u-calendar-header__title" |
||||
v-if="showTitle" |
||||
>{{ title }}</text> |
||||
<text |
||||
class="u-calendar-header__subtitle" |
||||
v-if="showSubtitle" |
||||
>{{ subtitle }}</text> |
||||
<view class="u-calendar-header__weekdays"> |
||||
<text class="u-calendar-header__weekdays__weekday">一</text> |
||||
<text class="u-calendar-header__weekdays__weekday">二</text> |
||||
<text class="u-calendar-header__weekdays__weekday">三</text> |
||||
<text class="u-calendar-header__weekdays__weekday">四</text> |
||||
<text class="u-calendar-header__weekdays__weekday">五</text> |
||||
<text class="u-calendar-header__weekdays__weekday">六</text> |
||||
<text class="u-calendar-header__weekdays__weekday">日</text> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'u-calendar-header', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin], |
||||
props: { |
||||
// 标题 |
||||
title: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
// 副标题 |
||||
subtitle: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
// 是否显示标题 |
||||
showTitle: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
// 是否显示副标题 |
||||
showSubtitle: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
}, |
||||
data() { |
||||
return { |
||||
|
||||
} |
||||
}, |
||||
methods: { |
||||
name() { |
||||
|
||||
} |
||||
}, |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
.u-calendar-header { |
||||
padding-bottom: 4px; |
||||
|
||||
&__title { |
||||
font-size: 16px; |
||||
color: $u-main-color; |
||||
text-align: center; |
||||
height: 42px; |
||||
line-height: 42px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
&__subtitle { |
||||
font-size: 14px; |
||||
color: $u-main-color; |
||||
height: 40px; |
||||
text-align: center; |
||||
line-height: 40px; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
&__weekdays { |
||||
@include flex; |
||||
justify-content: space-between; |
||||
|
||||
&__weekday { |
||||
font-size: 13px; |
||||
color: $u-main-color; |
||||
line-height: 30px; |
||||
flex: 1; |
||||
text-align: center; |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -1,579 +0,0 @@
|
||||
<template> |
||||
<view class="u-calendar-month-wrapper" ref="u-calendar-month-wrapper"> |
||||
<view v-for="(item, index) in months" :key="index" :class="[`u-calendar-month-${index}`]" |
||||
:ref="`u-calendar-month-${index}`" :id="`month-${index}`"> |
||||
<text v-if="index !== 0" class="u-calendar-month__title">{{ item.year }}年{{ item.month }}月</text> |
||||
<view class="u-calendar-month__days"> |
||||
<view v-if="showMark" class="u-calendar-month__days__month-mark-wrapper"> |
||||
<text class="u-calendar-month__days__month-mark-wrapper__text">{{ item.month }}</text> |
||||
</view> |
||||
<view class="u-calendar-month__days__day" v-for="(item1, index1) in item.date" :key="index1" |
||||
:style="[dayStyle(index, index1, item1)]" @tap="clickHandler(index, index1, item1)" |
||||
:class="[item1.selected && 'u-calendar-month__days__day__select--selected']"> |
||||
<view class="u-calendar-month__days__day__select" :style="[daySelectStyle(index, index1, item1)]"> |
||||
<text class="u-calendar-month__days__day__select__info" |
||||
:class="[item1.disabled && 'u-calendar-month__days__day__select__info--disabled']" |
||||
:style="[textStyle(item1)]">{{ item1.day }}</text> |
||||
<text v-if="getBottomInfo(index, index1, item1)" |
||||
class="u-calendar-month__days__day__select__buttom-info" |
||||
:class="[item1.disabled && 'u-calendar-month__days__day__select__buttom-info--disabled']" |
||||
:style="[textStyle(item1)]">{{ getBottomInfo(index, index1, item1) }}</text> |
||||
<text v-if="item1.dot" class="u-calendar-month__days__day__select__dot"></text> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
// #ifdef APP-NVUE |
||||
// 由于nvue不支持百分比单位,需要查询宽度来计算每个日期的宽度 |
||||
const dom = uni.requireNativePlugin('dom') |
||||
// #endif |
||||
import dayjs from '../../libs/util/dayjs.js'; |
||||
export default { |
||||
name: 'u-calendar-month', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin], |
||||
props: { |
||||
// 是否显示月份背景色 |
||||
showMark: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
// 主题色,对底部按钮和选中日期有效 |
||||
color: { |
||||
type: String, |
||||
default: '#3c9cff' |
||||
}, |
||||
// 月份数据 |
||||
months: { |
||||
type: Array, |
||||
default: () => [] |
||||
}, |
||||
// 日期选择类型 |
||||
mode: { |
||||
type: String, |
||||
default: 'single' |
||||
}, |
||||
// 日期行高 |
||||
rowHeight: { |
||||
type: [String, Number], |
||||
default: 58 |
||||
}, |
||||
// mode=multiple时,最多可选多少个日期 |
||||
maxCount: { |
||||
type: [String, Number], |
||||
default: Infinity |
||||
}, |
||||
// mode=range时,第一个日期底部的提示文字 |
||||
startText: { |
||||
type: String, |
||||
default: '开始' |
||||
}, |
||||
// mode=range时,最后一个日期底部的提示文字 |
||||
endText: { |
||||
type: String, |
||||
default: '结束' |
||||
}, |
||||
// 默认选中的日期,mode为multiple或range是必须为数组格式 |
||||
defaultDate: { |
||||
type: [Array, String, Date], |
||||
default: null |
||||
}, |
||||
// 最小的可选日期 |
||||
minDate: { |
||||
type: [String, Number], |
||||
default: 0 |
||||
}, |
||||
// 最大可选日期 |
||||
maxDate: { |
||||
type: [String, Number], |
||||
default: 0 |
||||
}, |
||||
// 如果没有设置maxDate,则往后推多少个月 |
||||
maxMonth: { |
||||
type: [String, Number], |
||||
default: 2 |
||||
}, |
||||
// 是否为只读状态,只读状态下禁止选择日期 |
||||
readonly: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.readonly |
||||
}, |
||||
// 日期区间最多可选天数,默认无限制,mode = range时有效 |
||||
maxRange: { |
||||
type: [Number, String], |
||||
default: Infinity |
||||
}, |
||||
// 范围选择超过最多可选天数时的提示文案,mode = range时有效 |
||||
rangePrompt: { |
||||
type: String, |
||||
default: '' |
||||
}, |
||||
// 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 |
||||
showRangePrompt: { |
||||
type: Boolean, |
||||
default: true |
||||
}, |
||||
// 是否允许日期范围的起止时间为同一天,mode = range时有效 |
||||
allowSameDay: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
}, |
||||
data() { |
||||
return { |
||||
// 每个日期的宽度 |
||||
width: 0, |
||||
// 当前选中的日期item |
||||
item: {}, |
||||
selected: [] |
||||
} |
||||
}, |
||||
watch: { |
||||
selectedChange: { |
||||
immediate: true, |
||||
handler(n) { |
||||
this.setDefaultDate() |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
// 多个条件的变化,会引起选中日期的变化,这里统一管理监听 |
||||
selectedChange() { |
||||
return [this.minDate, this.maxDate, this.defaultDate] |
||||
}, |
||||
dayStyle(index1, index2, item) { |
||||
return (index1, index2, item) => { |
||||
const style = {} |
||||
let week = item.week |
||||
// 不进行四舍五入的形式保留2位小数 |
||||
const dayWidth = Number(parseFloat(this.width / 7).toFixed(3).slice(0, -1)) |
||||
// 得出每个日期的宽度 |
||||
// #ifdef APP-NVUE |
||||
style.width = uni.$u.addUnit(dayWidth) |
||||
// #endif |
||||
style.height = uni.$u.addUnit(this.rowHeight) |
||||
if (index2 === 0) { |
||||
// 获取当前为星期几,如果为0,则为星期天,减一为每月第一天时,需要向左偏移的item个数 |
||||
week = (week === 0 ? 7 : week) - 1 |
||||
style.marginLeft = uni.$u.addUnit(week * dayWidth) |
||||
} |
||||
if (this.mode === 'range') { |
||||
// 之所以需要这么写,是因为DCloud公司的iOS客户端的开发者能力有限导致的bug |
||||
style.paddingLeft = 0 |
||||
style.paddingRight = 0 |
||||
style.paddingBottom = 0 |
||||
style.paddingTop = 0 |
||||
} |
||||
return style |
||||
} |
||||
}, |
||||
daySelectStyle() { |
||||
return (index1, index2, item) => { |
||||
let date = dayjs(item.date).format("YYYY-MM-DD"), |
||||
style = {} |
||||
// 判断date是否在selected数组中,因为月份可能会需要补0,所以使用dateSame判断,而不用数组的includes判断 |
||||
if (this.selected.some(item => this.dateSame(item, date))) { |
||||
style.backgroundColor = this.color |
||||
} |
||||
if (this.mode === 'single') { |
||||
if (date === this.selected[0]) { |
||||
// 因为需要对nvue的兼容,只能这么写,无法缩写,也无法通过类名控制等等 |
||||
style.borderTopLeftRadius = '3px' |
||||
style.borderBottomLeftRadius = '3px' |
||||
style.borderTopRightRadius = '3px' |
||||
style.borderBottomRightRadius = '3px' |
||||
} |
||||
} else if (this.mode === 'range') { |
||||
if (this.selected.length >= 2) { |
||||
const len = this.selected.length - 1 |
||||
// 第一个日期设置左上角和左下角的圆角 |
||||
if (this.dateSame(date, this.selected[0])) { |
||||
style.borderTopLeftRadius = '3px' |
||||
style.borderBottomLeftRadius = '3px' |
||||
} |
||||
// 最后一个日期设置右上角和右下角的圆角 |
||||
if (this.dateSame(date, this.selected[len])) { |
||||
style.borderTopRightRadius = '3px' |
||||
style.borderBottomRightRadius = '3px' |
||||
} |
||||
// 处于第一和最后一个之间的日期,背景色设置为浅色,通过将对应颜色进行等分,再取其尾部的颜色值 |
||||
if (dayjs(date).isAfter(dayjs(this.selected[0])) && dayjs(date).isBefore(dayjs(this |
||||
.selected[len]))) { |
||||
style.backgroundColor = uni.$u.colorGradient(this.color, '#ffffff', 100)[90] |
||||
// 增加一个透明度,让范围区间的背景色也能看到底部的mark水印字符 |
||||
style.opacity = 0.7 |
||||
} |
||||
} else if (this.selected.length === 1) { |
||||
// 之所以需要这么写,是因为DCloud公司的iOS客户端的开发者能力有限导致的bug |
||||
// 进行还原操作,否则在nvue的iOS,uni-app有bug,会导致诡异的表现 |
||||
style.borderTopLeftRadius = '3px' |
||||
style.borderBottomLeftRadius = '3px' |
||||
} |
||||
} else { |
||||
if (this.selected.some(item => this.dateSame(item, date))) { |
||||
style.borderTopLeftRadius = '3px' |
||||
style.borderBottomLeftRadius = '3px' |
||||
style.borderTopRightRadius = '3px' |
||||
style.borderBottomRightRadius = '3px' |
||||
} |
||||
} |
||||
return style |
||||
} |
||||
}, |
||||
// 某个日期是否被选中 |
||||
textStyle() { |
||||
return (item) => { |
||||
const date = dayjs(item.date).format("YYYY-MM-DD"), |
||||
style = {} |
||||
// 选中的日期,提示文字设置白色 |
||||
if (this.selected.some(item => this.dateSame(item, date))) { |
||||
style.color = '#ffffff' |
||||
} |
||||
if (this.mode === 'range') { |
||||
const len = this.selected.length - 1 |
||||
// 如果是范围选择模式,第一个和最后一个之间的日期,文字颜色设置为高亮的主题色 |
||||
if (dayjs(date).isAfter(dayjs(this.selected[0])) && dayjs(date).isBefore(dayjs(this |
||||
.selected[len]))) { |
||||
style.color = this.color |
||||
} |
||||
} |
||||
return style |
||||
} |
||||
}, |
||||
// 获取底部的提示文字 |
||||
getBottomInfo() { |
||||
return (index1, index2, item) => { |
||||
const date = dayjs(item.date).format("YYYY-MM-DD") |
||||
const bottomInfo = item.bottomInfo |
||||
// 当为日期范围模式时,且选择的日期个数大于0时 |
||||
if (this.mode === 'range' && this.selected.length > 0) { |
||||
if (this.selected.length === 1) { |
||||
// 选择了一个日期时,如果当前日期为数组中的第一个日期,则显示底部文字为“开始” |
||||
if (this.dateSame(date, this.selected[0])) return this.startText |
||||
else return bottomInfo |
||||
} else { |
||||
const len = this.selected.length - 1 |
||||
// 如果数组中的日期大于2个时,第一个和最后一个显示为开始和结束日期 |
||||
if (this.dateSame(date, this.selected[0]) && this.dateSame(date, this.selected[1]) && |
||||
len === 1) { |
||||
// 如果长度为2,且第一个等于第二个日期,则提示语放在同一个item中 |
||||
return `${this.startText}/${this.endText}` |
||||
} else if (this.dateSame(date, this.selected[0])) { |
||||
return this.startText |
||||
} else if (this.dateSame(date, this.selected[len])) { |
||||
return this.endText |
||||
} else { |
||||
return bottomInfo |
||||
} |
||||
} |
||||
} else { |
||||
return bottomInfo |
||||
} |
||||
} |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
init() { |
||||
// 初始化默认选中 |
||||
this.$emit('monthSelected', this.selected) |
||||
this.$nextTick(() => { |
||||
// 这里需要另一个延时,因为获取宽度后,会进行月份数据渲染,只有渲染完成之后,才有真正的高度 |
||||
// 因为nvue下,$nextTick并不是100%可靠的 |
||||
uni.$u.sleep(10).then(() => { |
||||
this.getWrapperWidth() |
||||
this.getMonthRect() |
||||
}) |
||||
}) |
||||
}, |
||||
// 判断两个日期是否相等 |
||||
dateSame(date1, date2) { |
||||
return dayjs(date1).isSame(dayjs(date2)) |
||||
}, |
||||
// 获取月份数据区域的宽度,因为nvue不支持百分比,所以无法通过css设置每个日期item的宽度 |
||||
getWrapperWidth() { |
||||
// #ifdef APP-NVUE |
||||
dom.getComponentRect(this.$refs['u-calendar-month-wrapper'], res => { |
||||
this.width = res.size.width |
||||
}) |
||||
// #endif |
||||
// #ifndef APP-NVUE |
||||
this.$uGetRect('.u-calendar-month-wrapper').then(size => { |
||||
this.width = size.width |
||||
}) |
||||
// #endif |
||||
}, |
||||
getMonthRect() { |
||||
// 获取每个月份数据的尺寸,用于父组件在scroll-view滚动事件中,监听当前滚动到了第几个月份 |
||||
const promiseAllArr = this.months.map((item, index) => this.getMonthRectByPromise( |
||||
`u-calendar-month-${index}`)) |
||||
// 一次性返回 |
||||
Promise.all(promiseAllArr).then( |
||||
sizes => { |
||||
let height = 1 |
||||
const topArr = [] |
||||
for (let i = 0; i < this.months.length; i++) { |
||||
// 添加到months数组中,供scroll-view滚动事件中,判断当前滚动到哪个月份 |
||||
topArr[i] = height |
||||
height += sizes[i].height |
||||
} |
||||
// 由于微信下,无法通过this.months[i].top的形式(引用类型)去修改父组件的month的top值,所以使用事件形式对外发出 |
||||
this.$emit('updateMonthTop', topArr) |
||||
}) |
||||
}, |
||||
// 获取每个月份区域的尺寸 |
||||
getMonthRectByPromise(el) { |
||||
// #ifndef APP-NVUE |
||||
// $uGetRect为uView自带的节点查询简化方法,详见文档介绍:https://www.uviewui.com/js/getRect.html |
||||
// 组件内部一般用this.$uGetRect,对外的为uni.$u.getRect,二者功能一致,名称不同 |
||||
return new Promise(resolve => { |
||||
this.$uGetRect(`.${el}`).then(size => { |
||||
resolve(size) |
||||
}) |
||||
}) |
||||
// #endif |
||||
|
||||
// #ifdef APP-NVUE |
||||
// nvue下,使用dom模块查询元素高度 |
||||
// 返回一个promise,让调用此方法的主体能使用then回调 |
||||
return new Promise(resolve => { |
||||
dom.getComponentRect(this.$refs[el][0], res => { |
||||
resolve(res.size) |
||||
}) |
||||
}) |
||||
// #endif |
||||
}, |
||||
// 点击某一个日期 |
||||
clickHandler(index1, index2, item) { |
||||
if (this.readonly) { |
||||
return; |
||||
} |
||||
this.item = item |
||||
const date = dayjs(item.date).format("YYYY-MM-DD") |
||||
if (item.disabled) return |
||||
// 对上一次选择的日期数组进行深度克隆 |
||||
let selected = uni.$u.deepClone(this.selected) |
||||
if (this.mode === 'single') { |
||||
// 单选情况下,让数组中的元素为当前点击的日期 |
||||
selected = [date] |
||||
} else if (this.mode === 'multiple') { |
||||
if (selected.some(item => this.dateSame(item, date))) { |
||||
// 如果点击的日期已在数组中,则进行移除操作,也就是达到反选的效果 |
||||
const itemIndex = selected.findIndex(item => item === date) |
||||
selected.splice(itemIndex, 1) |
||||
} else { |
||||
// 如果点击的日期不在数组中,且已有的长度小于总可选长度时,则添加到数组中去 |
||||
if (selected.length < this.maxCount) selected.push(date) |
||||
} |
||||
} else { |
||||
// 选择区间形式 |
||||
if (selected.length === 0 || selected.length >= 2) { |
||||
// 如果原来就为0或者大于2的长度,则当前点击的日期,就是开始日期 |
||||
selected = [date] |
||||
} else if (selected.length === 1) { |
||||
// 如果已经选择了开始日期 |
||||
const existsDate = selected[0] |
||||
// 如果当前选择的日期小于上一次选择的日期,则当前的日期定为开始日期 |
||||
if (dayjs(date).isBefore(existsDate)) { |
||||
selected = [date] |
||||
} else if (dayjs(date).isAfter(existsDate)) { |
||||
// 当前日期减去最大可选的日期天数,如果大于起始时间,则进行提示 |
||||
if(dayjs(dayjs(date).subtract(this.maxRange, 'day')).isAfter(dayjs(selected[0])) && this.showRangePrompt) { |
||||
if(this.rangePrompt) { |
||||
uni.$u.toast(this.rangePrompt) |
||||
} else { |
||||
uni.$u.toast(`选择天数不能超过 ${this.maxRange} 天`) |
||||
} |
||||
return |
||||
} |
||||
// 如果当前日期大于已有日期,将当前的添加到数组尾部 |
||||
selected.push(date) |
||||
const startDate = selected[0] |
||||
const endDate = selected[1] |
||||
const arr = [] |
||||
let i = 0 |
||||
do { |
||||
// 将开始和结束日期之间的日期添加到数组中 |
||||
arr.push(dayjs(startDate).add(i, 'day').format("YYYY-MM-DD")) |
||||
i++ |
||||
// 累加的日期小于结束日期时,继续下一次的循环 |
||||
} while (dayjs(startDate).add(i, 'day').isBefore(dayjs(endDate))) |
||||
// 为了一次性修改数组,避免computed中多次触发,这里才用arr变量一次性赋值的方式,同时将最后一个日期添加近来 |
||||
arr.push(endDate) |
||||
selected = arr |
||||
} else { |
||||
// 选择区间时,只有一个日期的情况下,且不允许选择起止为同一天的话,不允许选择自己 |
||||
if (selected[0] === date && !this.allowSameDay) return |
||||
selected.push(date) |
||||
} |
||||
} |
||||
} |
||||
this.setSelected(selected) |
||||
}, |
||||
// 设置默认日期 |
||||
setDefaultDate() { |
||||
if (!this.defaultDate) { |
||||
// 如果没有设置默认日期,则将当天日期设置为默认选中的日期 |
||||
const selected = [dayjs().format("YYYY-MM-DD")] |
||||
return this.setSelected(selected, false) |
||||
} |
||||
let defaultDate = [] |
||||
const minDate = this.minDate || dayjs().format("YYYY-MM-DD") |
||||
const maxDate = this.maxDate || dayjs(minDate).add(this.maxMonth - 1, 'month').format("YYYY-MM-DD") |
||||
if (this.mode === 'single') { |
||||
// 单选模式,可以是字符串或数组,Date对象等 |
||||
if (!uni.$u.test.array(this.defaultDate)) { |
||||
defaultDate = [dayjs(this.defaultDate).format("YYYY-MM-DD")] |
||||
} else { |
||||
defaultDate = [this.defaultDate[0]] |
||||
} |
||||
} else { |
||||
// 如果为非数组,则不执行 |
||||
if (!uni.$u.test.array(this.defaultDate)) return |
||||
defaultDate = this.defaultDate |
||||
} |
||||
// 过滤用户传递的默认数组,取出只在可允许最大值与最小值之间的元素 |
||||
defaultDate = defaultDate.filter(item => { |
||||
return dayjs(item).isAfter(dayjs(minDate).subtract(1, 'day')) && dayjs(item).isBefore(dayjs( |
||||
maxDate).add(1, 'day')) |
||||
}) |
||||
this.setSelected(defaultDate, false) |
||||
}, |
||||
setSelected(selected, event = true) { |
||||
this.selected = selected |
||||
event && this.$emit('monthSelected', this.selected) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import "../../libs/css/components.scss"; |
||||
|
||||
.u-calendar-month-wrapper { |
||||
margin-top: 4px; |
||||
} |
||||
|
||||
.u-calendar-month { |
||||
|
||||
&__title { |
||||
font-size: 14px; |
||||
line-height: 42px; |
||||
height: 42px; |
||||
color: $u-main-color; |
||||
text-align: center; |
||||
font-weight: bold; |
||||
} |
||||
|
||||
&__days { |
||||
position: relative; |
||||
@include flex; |
||||
flex-wrap: wrap; |
||||
|
||||
&__month-mark-wrapper { |
||||
position: absolute; |
||||
top: 0; |
||||
bottom: 0; |
||||
left: 0; |
||||
right: 0; |
||||
@include flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
|
||||
&__text { |
||||
font-size: 155px; |
||||
color: rgba(231, 232, 234, 0.83); |
||||
} |
||||
} |
||||
|
||||
&__day { |
||||
@include flex; |
||||
padding: 2px; |
||||
/* #ifndef APP-NVUE */ |
||||
// vue下使用css进行宽度计算,因为某些安卓机会无法进行js获取父元素宽度进行计算得出,会有偏移 |
||||
width: calc(100% / 7); |
||||
box-sizing: border-box; |
||||
/* #endif */ |
||||
|
||||
&__select { |
||||
flex: 1; |
||||
@include flex; |
||||
align-items: center; |
||||
justify-content: center; |
||||
position: relative; |
||||
|
||||
&__dot { |
||||
width: 7px; |
||||
height: 7px; |
||||
border-radius: 100px; |
||||
background-color: $u-error; |
||||
position: absolute; |
||||
top: 12px; |
||||
right: 7px; |
||||
} |
||||
|
||||
&__buttom-info { |
||||
color: $u-content-color; |
||||
text-align: center; |
||||
position: absolute; |
||||
bottom: 5px; |
||||
font-size: 10px; |
||||
text-align: center; |
||||
left: 0; |
||||
right: 0; |
||||
|
||||
&--selected { |
||||
color: #ffffff; |
||||
} |
||||
|
||||
&--disabled { |
||||
color: #cacbcd; |
||||
} |
||||
} |
||||
|
||||
&__info { |
||||
text-align: center; |
||||
font-size: 16px; |
||||
|
||||
&--selected { |
||||
color: #ffffff; |
||||
} |
||||
|
||||
&--disabled { |
||||
color: #cacbcd; |
||||
} |
||||
} |
||||
|
||||
&--selected { |
||||
background-color: $u-primary; |
||||
@include flex; |
||||
justify-content: center; |
||||
align-items: center; |
||||
flex: 1; |
||||
border-radius: 3px; |
||||
} |
||||
|
||||
&--range-selected { |
||||
opacity: 0.3; |
||||
border-radius: 0; |
||||
} |
||||
|
||||
&--range-start-selected { |
||||
border-top-right-radius: 0; |
||||
border-bottom-right-radius: 0; |
||||
} |
||||
|
||||
&--range-end-selected { |
||||
border-top-left-radius: 0; |
||||
border-bottom-left-radius: 0; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
</style> |
@ -1,144 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 日历顶部标题
|
||||
title: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.title |
||||
}, |
||||
// 是否显示标题
|
||||
showTitle: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.showTitle |
||||
}, |
||||
// 是否显示副标题
|
||||
showSubtitle: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.showSubtitle |
||||
}, |
||||
// 日期类型选择,single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围
|
||||
mode: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.mode |
||||
}, |
||||
// mode=range时,第一个日期底部的提示文字
|
||||
startText: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.startText |
||||
}, |
||||
// mode=range时,最后一个日期底部的提示文字
|
||||
endText: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.endText |
||||
}, |
||||
// 自定义列表
|
||||
customList: { |
||||
type: Array, |
||||
default: uni.$u.props.calendar.customList |
||||
}, |
||||
// 主题色,对底部按钮和选中日期有效
|
||||
color: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.color |
||||
}, |
||||
// 最小的可选日期
|
||||
minDate: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.calendar.minDate |
||||
}, |
||||
// 最大可选日期
|
||||
maxDate: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.calendar.maxDate |
||||
}, |
||||
// 默认选中的日期,mode为multiple或range是必须为数组格式
|
||||
defaultDate: { |
||||
type: [Array, String, Date, null], |
||||
default: uni.$u.props.calendar.defaultDate |
||||
}, |
||||
// mode=multiple时,最多可选多少个日期
|
||||
maxCount: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.calendar.maxCount |
||||
}, |
||||
// 日期行高
|
||||
rowHeight: { |
||||
type: [String, Number], |
||||
default: uni.$u.props.calendar.rowHeight |
||||
}, |
||||
// 日期格式化函数
|
||||
formatter: { |
||||
type: [Function, null], |
||||
default: uni.$u.props.calendar.formatter |
||||
}, |
||||
// 是否显示农历
|
||||
showLunar: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.showLunar |
||||
}, |
||||
// 是否显示月份背景色
|
||||
showMark: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.showMark |
||||
}, |
||||
// 确定按钮的文字
|
||||
confirmText: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.confirmText |
||||
}, |
||||
// 确认按钮处于禁用状态时的文字
|
||||
confirmDisabledText: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.confirmDisabledText |
||||
}, |
||||
// 是否显示日历弹窗
|
||||
show: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.show |
||||
}, |
||||
// 是否允许点击遮罩关闭日历
|
||||
closeOnClickOverlay: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.closeOnClickOverlay |
||||
}, |
||||
// 是否为只读状态,只读状态下禁止选择日期
|
||||
readonly: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.readonly |
||||
}, |
||||
// 是否展示确认按钮
|
||||
showConfirm: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.showConfirm |
||||
}, |
||||
// 日期区间最多可选天数,默认无限制,mode = range时有效
|
||||
maxRange: { |
||||
type: [Number, String], |
||||
default: uni.$u.props.calendar.maxRange |
||||
}, |
||||
// 范围选择超过最多可选天数时的提示文案,mode = range时有效
|
||||
rangePrompt: { |
||||
type: String, |
||||
default: uni.$u.props.calendar.rangePrompt |
||||
}, |
||||
// 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效
|
||||
showRangePrompt: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.showRangePrompt |
||||
}, |
||||
// 是否允许日期范围的起止时间为同一天,mode = range时有效
|
||||
allowSameDay: { |
||||
type: Boolean, |
||||
default: uni.$u.props.calendar.allowSameDay |
||||
}, |
||||
// 圆角值
|
||||
round: { |
||||
type: [Boolean, String, Number], |
||||
default: uni.$u.props.calendar.round |
||||
}, |
||||
// 最多展示月份数量
|
||||
monthNum: { |
||||
type: [Number, String], |
||||
default: 3 |
||||
}
|
||||
} |
||||
} |
@ -1,383 +0,0 @@
|
||||
<template> |
||||
<u-popup |
||||
:show="show" |
||||
mode="bottom" |
||||
closeable |
||||
@close="close" |
||||
:round="round" |
||||
:closeOnClickOverlay="closeOnClickOverlay" |
||||
> |
||||
<view class="u-calendar"> |
||||
<uHeader |
||||
:title="title" |
||||
:subtitle="subtitle" |
||||
:showSubtitle="showSubtitle" |
||||
:showTitle="showTitle" |
||||
></uHeader> |
||||
<scroll-view |
||||
:style="{ |
||||
height: $u.addUnit(listHeight) |
||||
}" |
||||
scroll-y |
||||
@scroll="onScroll" |
||||
:scroll-top="scrollTop" |
||||
:scrollIntoView="scrollIntoView" |
||||
> |
||||
<uMonth |
||||
:color="color" |
||||
:rowHeight="rowHeight" |
||||
:showMark="showMark" |
||||
:months="months" |
||||
:mode="mode" |
||||
:maxCount="maxCount" |
||||
:startText="startText" |
||||
:endText="endText" |
||||
:defaultDate="defaultDate" |
||||
:minDate="innerMinDate" |
||||
:maxDate="innerMaxDate" |
||||
:maxMonth="monthNum" |
||||
:readonly="readonly" |
||||
:maxRange="maxRange" |
||||
:rangePrompt="rangePrompt" |
||||
:showRangePrompt="showRangePrompt" |
||||
:allowSameDay="allowSameDay" |
||||
ref="month" |
||||
@monthSelected="monthSelected" |
||||
@updateMonthTop="updateMonthTop" |
||||
></uMonth> |
||||
</scroll-view> |
||||
<slot name="footer" v-if="showConfirm"> |
||||
<view class="u-calendar__confirm"> |
||||
<u-button |
||||
shape="circle" |
||||
:text=" |
||||
buttonDisabled ? confirmDisabledText : confirmText |
||||
" |
||||
:color="color" |
||||
@click="confirm" |
||||
:disabled="buttonDisabled" |
||||
></u-button> |
||||
</view> |
||||
</slot> |
||||
</view> |
||||
</u-popup> |
||||
</template> |
||||
|
||||
<script> |
||||
import uHeader from './header.vue' |
||||
import uMonth from './month.vue' |
||||
import props from './props.js' |
||||
import util from './util.js' |
||||
import dayjs from '../../libs/util/dayjs.js' |
||||
import Calendar from '../../libs/util/calendar.js' |
||||
/** |
||||
* Calendar 日历 |
||||
* @description 此组件用于单个选择日期,范围选择日期等,日历被包裹在底部弹起的容器中. |
||||
* @tutorial https://www.uviewui.com/components/calendar.html |
||||
* |
||||
* @property {String} title 标题内容 (默认 日期选择 ) |
||||
* @property {Boolean} showTitle 是否显示标题 (默认 true ) |
||||
* @property {Boolean} showSubtitle 是否显示副标题 (默认 true ) |
||||
* @property {String} mode 日期类型选择 single-选择单个日期,multiple-可以选择多个日期,range-选择日期范围 ( 默认 'single' ) |
||||
* @property {String} startText mode=range时,第一个日期底部的提示文字 (默认 '开始' ) |
||||
* @property {String} endText mode=range时,最后一个日期底部的提示文字 (默认 '结束' ) |
||||
* @property {Array} customList 自定义列表 |
||||
* @property {String} color 主题色,对底部按钮和选中日期有效 (默认 ‘#3c9cff' ) |
||||
* @property {String | Number} minDate 最小的可选日期 (默认 0 ) |
||||
* @property {String | Number} maxDate 最大可选日期 (默认 0 ) |
||||
* @property {Array | String| Date} defaultDate 默认选中的日期,mode为multiple或range是必须为数组格式 |
||||
* @property {String | Number} maxCount mode=multiple时,最多可选多少个日期 (默认 Number.MAX_SAFE_INTEGER ) |
||||
* @property {String | Number} rowHeight 日期行高 (默认 56 ) |
||||
* @property {Function} formatter 日期格式化函数 |
||||
* @property {Boolean} showLunar 是否显示农历 (默认 false ) |
||||
* @property {Boolean} showMark 是否显示月份背景色 (默认 true ) |
||||
* @property {String} confirmText 确定按钮的文字 (默认 '确定' ) |
||||
* @property {String} confirmDisabledText 确认按钮处于禁用状态时的文字 (默认 '确定' ) |
||||
* @property {Boolean} show 是否显示日历弹窗 (默认 false ) |
||||
* @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭日历 (默认 false ) |
||||
* @property {Boolean} readonly 是否为只读状态,只读状态下禁止选择日期 (默认 false ) |
||||
* @property {String | Number} maxRange 日期区间最多可选天数,默认无限制,mode = range时有效 |
||||
* @property {String} rangePrompt 范围选择超过最多可选天数时的提示文案,mode = range时有效 |
||||
* @property {Boolean} showRangePrompt 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 (默认 true ) |
||||
* @property {Boolean} allowSameDay 是否允许日期范围的起止时间为同一天,mode = range时有效 (默认 false ) |
||||
* @property {Number|String} round 圆角值,默认无圆角 (默认 0 ) |
||||
* @property {Number|String} monthNum 最多展示的月份数量 (默认 3 ) |
||||
* |
||||
* @event {Function()} confirm 点击确定按钮时触发 选择日期相关的返回参数 |
||||
* @event {Function()} close 日历关闭时触发 可定义页面关闭时的回调事件 |
||||
* @example <u-calendar :defaultDate="defaultDateMultiple" :show="show" mode="multiple" @confirm="confirm"> |
||||
</u-calendar> |
||||
* */ |
||||
export default { |
||||
name: 'u-calendar', |
||||
mixins: [uni.$u.mpMixin, uni.$u.mixin, props], |
||||
components: { |
||||
uHeader, |
||||
uMonth |
||||
}, |
||||
data() { |
||||
return { |
||||
// 需要显示的月份的数组 |
||||
months: [], |
||||
// 在月份滚动区域中,当前视图中月份的index索引 |
||||
monthIndex: 0, |
||||
// 月份滚动区域的高度 |
||||
listHeight: 0, |
||||
// month组件中选择的日期数组 |
||||
selected: [], |
||||
scrollIntoView: '', |
||||
scrollTop:0, |
||||
// 过滤处理方法 |
||||
innerFormatter: (value) => value |
||||
} |
||||
}, |
||||
watch: { |
||||
selectedChange: { |
||||
immediate: true, |
||||
handler(n) { |
||||
this.setMonth() |
||||
} |
||||
}, |
||||
// 打开弹窗时,设置月份数据 |
||||
show: { |
||||
immediate: true, |
||||
handler(n) { |
||||
this.setMonth() |
||||
} |
||||
} |
||||
}, |
||||
computed: { |
||||
// 由于maxDate和minDate可以为字符串(2021-10-10),或者数值(时间戳),但是dayjs如果接受字符串形式的时间戳会有问题,这里进行处理 |
||||
innerMaxDate() { |
||||
return uni.$u.test.number(this.maxDate) |
||||
? Number(this.maxDate) |
||||
: this.maxDate |
||||
}, |
||||
innerMinDate() { |
||||
return uni.$u.test.number(this.minDate) |
||||
? Number(this.minDate) |
||||
: this.minDate |
||||
}, |
||||
// 多个条件的变化,会引起选中日期的变化,这里统一管理监听 |
||||
selectedChange() { |
||||
return [this.innerMinDate, this.innerMaxDate, this.defaultDate] |
||||
}, |
||||
subtitle() { |
||||
// 初始化时,this.months为空数组,所以需要特别判断处理 |
||||
if (this.months.length) { |
||||
return `${this.months[this.monthIndex].year}年${ |
||||
this.months[this.monthIndex].month |
||||
}月` |
||||
} else { |
||||
return '' |
||||
} |
||||
}, |
||||
buttonDisabled() { |
||||
// 如果为range类型,且选择的日期个数不足1个时,让底部的按钮出于disabled状态 |
||||
if (this.mode === 'range') { |
||||
if (this.selected.length <= 1) { |
||||
return true |
||||
} else { |
||||
return false |
||||
} |
||||
} else { |
||||
return false |
||||
} |
||||
} |
||||
}, |
||||
mounted() { |
||||
this.start = Date.now() |
||||
this.init() |
||||
}, |
||||
methods: { |
||||
// 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用 |
||||
setFormatter(e) { |
||||
this.innerFormatter = e |
||||
}, |
||||
// month组件内部选择日期后,通过事件通知给父组件 |
||||
monthSelected(e) { |
||||
this.selected = e |
||||
if (!this.showConfirm) { |
||||
// 在不需要确认按钮的情况下,如果为单选,或者范围多选且已选长度大于2,则直接进行返还 |
||||
if ( |
||||
this.mode === 'multiple' || |
||||
this.mode === 'single' || |
||||
(this.mode === 'range' && this.selected.length >= 2) |
||||
) { |
||||
this.$emit('confirm', this.selected) |
||||
} |
||||
} |
||||
}, |
||||
init() { |
||||
// 校验maxDate,不能小于当前时间 |
||||
if ( |
||||
this.innerMaxDate && |
||||
new Date(this.innerMaxDate).getTime() <= Date.now() |
||||
) { |
||||
return uni.$u.error('maxDate不能小于当前时间') |
||||
} |
||||
// 滚动区域的高度 |
||||
this.listHeight = this.rowHeight * 5 + 30 |
||||
this.setMonth() |
||||
}, |
||||
close() { |
||||
this.$emit('close') |
||||
}, |
||||
// 点击确定按钮 |
||||
confirm() { |
||||
if (!this.buttonDisabled) { |
||||
this.$emit('confirm', this.selected) |
||||
} |
||||
}, |
||||
// 获得两个日期之间的月份数 |
||||
getMonths(minDate, maxDate) { |
||||
const minYear = dayjs(minDate).year() |
||||
const minMonth = dayjs(minDate).month() + 1 |
||||
const maxYear = dayjs(maxDate).year() |
||||
const maxMonth = dayjs(maxDate).month() + 1 |
||||
return (maxYear - minYear) * 12 + (maxMonth - minMonth) + 1 |
||||
}, |
||||
// 设置月份数据 |
||||
setMonth() { |
||||
// 最小日期的毫秒数 |
||||
const minDate = this.innerMinDate || dayjs().valueOf() |
||||
// 如果没有指定最大日期,则往后推3个月 |
||||
const maxDate = |
||||
this.innerMaxDate || |
||||
dayjs(minDate) |
||||
.add(this.monthNum - 1, 'month') |
||||
.valueOf() |
||||
// 最大最小月份之间的共有多少个月份, |
||||
const months = uni.$u.range( |
||||
1, |
||||
this.monthNum, |
||||
this.getMonths(minDate, maxDate) |
||||
) |
||||
// 先清空数组 |
||||
this.months = [] |
||||
for (let i = 0; i < months; i++) { |
||||
this.months.push({ |
||||
date: new Array( |
||||
dayjs(minDate).add(i, 'month').daysInMonth() |
||||
) |
||||
.fill(1) |
||||
.map((item, index) => { |
||||
// 日期,取值1-31 |
||||
let day = index + 1 |
||||
// 星期,0-6,0为周日 |
||||
const week = dayjs(minDate) |
||||
.add(i, 'month') |
||||
.date(day) |
||||
.day() |
||||
const date = dayjs(minDate) |
||||
.add(i, 'month') |
||||
.date(day) |
||||
.format('YYYY-MM-DD') |
||||
let bottomInfo = '' |
||||
if (this.showLunar) { |
||||
// 将日期转为农历格式 |
||||
const lunar = Calendar.solar2lunar( |
||||
dayjs(date).year(), |
||||
dayjs(date).month() + 1, |
||||
dayjs(date).date() |
||||
) |
||||
bottomInfo = lunar.IDayCn |
||||
} |
||||
let config = { |
||||
day, |
||||
week, |
||||
// 小于最小允许的日期,或者大于最大的日期,则设置为disabled状态 |
||||
disabled: |
||||
dayjs(date).isBefore( |
||||
dayjs(minDate).format('YYYY-MM-DD') |
||||
) || |
||||
dayjs(date).isAfter( |
||||
dayjs(maxDate).format('YYYY-MM-DD') |
||||
), |
||||
// 返回一个日期对象,供外部的formatter获取当前日期的年月日等信息,进行加工处理 |
||||
date: new Date(date), |
||||
bottomInfo, |
||||
dot: false, |
||||
month: |
||||
dayjs(minDate).add(i, 'month').month() + 1 |
||||
} |
||||
const formatter = |
||||
this.formatter || this.innerFormatter |
||||
return formatter(config) |
||||
}), |
||||
// 当前所属的月份 |
||||
month: dayjs(minDate).add(i, 'month').month() + 1, |
||||
// 当前年份 |
||||
year: dayjs(minDate).add(i, 'month').year() |
||||
}) |
||||
} |
||||
|
||||
}, |
||||
// 滚动到默认设置的月份 |
||||
scrollIntoDefaultMonth(selected) { |
||||
// 查询默认日期在可选列表的下标 |
||||
const _index = this.months.findIndex(({ |
||||
year, |
||||
month |
||||
}) => { |
||||
month = uni.$u.padZero(month) |
||||
return `${year}-${month}` === selected |
||||
}) |
||||
if (_index !== -1) { |
||||
// #ifndef MP-WEIXIN |
||||
this.$nextTick(() => { |
||||
this.scrollIntoView = `month-${_index}` |
||||
}) |
||||
// #endif |
||||
// #ifdef MP-WEIXIN |
||||
this.scrollTop = this.months[_index].top || 0; |
||||
// #endif |
||||
} |
||||
}, |
||||
// scroll-view滚动监听 |
||||
onScroll(event) { |
||||
// 不允许小于0的滚动值,如果scroll-view到顶了,继续下拉,会出现负数值 |
||||
const scrollTop = Math.max(0, event.detail.scrollTop) |
||||
// 将当前滚动条数值,除以滚动区域的高度,可以得出当前滚动到了哪一个月份的索引 |
||||
for (let i = 0; i < this.months.length; i++) { |
||||
if (scrollTop >= (this.months[i].top || this.listHeight)) { |
||||
this.monthIndex = i |
||||
} |
||||
} |
||||
}, |
||||
// 更新月份的top值 |
||||
updateMonthTop(topArr = []) { |
||||
// 设置对应月份的top值,用于onScroll方法更新月份 |
||||
topArr.map((item, index) => { |
||||
this.months[index].top = item |
||||
}) |
||||
|
||||
// 获取默认日期的下标 |
||||
if (!this.defaultDate) { |
||||
// 如果没有设置默认日期,则将当天日期设置为默认选中的日期 |
||||
const selected = dayjs().format("YYYY-MM") |
||||
this.scrollIntoDefaultMonth(selected) |
||||
return |
||||
} |
||||
let selected = dayjs().format("YYYY-MM"); |
||||
// 单选模式,可以是字符串或数组,Date对象等 |
||||
if (!uni.$u.test.array(this.defaultDate)) { |
||||
selected = dayjs(this.defaultDate).format("YYYY-MM") |
||||
} else { |
||||
selected = dayjs(this.defaultDate[0]).format("YYYY-MM"); |
||||
} |
||||
this.scrollIntoDefaultMonth(selected) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
@import '../../libs/css/components.scss'; |
||||
|
||||
.u-calendar { |
||||
&__confirm { |
||||
padding: 7px 18px; |
||||
} |
||||
} |
||||
</style> |
@ -1,85 +0,0 @@
|
||||
export default { |
||||
methods: { |
||||
// 设置月份数据
|
||||
setMonth() { |
||||
// 月初是周几
|
||||
const day = dayjs(this.date).date(1).day() |
||||
const start = day == 0 ? 6 : day - 1 |
||||
|
||||
// 本月天数
|
||||
const days = dayjs(this.date).endOf('month').format('D') |
||||
|
||||
// 上个月天数
|
||||
const prevDays = dayjs(this.date).endOf('month').subtract(1, 'month').format('D') |
||||
|
||||
// 日期数据
|
||||
const arr = [] |
||||
// 清空表格
|
||||
this.month = [] |
||||
|
||||
// 添加上月数据
|
||||
arr.push( |
||||
...new Array(start).fill(1).map((e, i) => { |
||||
const day = prevDays - start + i + 1 |
||||
|
||||
return { |
||||
value: day, |
||||
disabled: true, |
||||
date: dayjs(this.date).subtract(1, 'month').date(day).format('YYYY-MM-DD') |
||||
} |
||||
}) |
||||
) |
||||
|
||||
// 添加本月数据
|
||||
arr.push( |
||||
...new Array(days - 0).fill(1).map((e, i) => { |
||||
const day = i + 1 |
||||
|
||||
return { |
||||
value: day, |
||||
date: dayjs(this.date).date(day).format('YYYY-MM-DD') |
||||
} |
||||
}) |
||||
) |
||||
|
||||
// 添加下个月
|
||||
arr.push( |
||||
...new Array(42 - days - start).fill(1).map((e, i) => { |
||||
const day = i + 1 |
||||
|
||||
return { |
||||
value: day, |
||||
disabled: true, |
||||
date: dayjs(this.date).add(1, 'month').date(day).format('YYYY-MM-DD') |
||||
} |
||||
}) |
||||
) |
||||
|
||||
// 分割数组
|
||||
for (let n = 0; n < arr.length; n += 7) { |
||||
this.month.push( |
||||
arr.slice(n, n + 7).map((e, i) => { |
||||
e.index = i + n |
||||
|
||||
// 自定义信息
|
||||
const custom = this.customList.find((c) => c.date == e.date) |
||||
|
||||
// 农历
|
||||
if (this.lunar) { |
||||
const { |
||||
IDayCn, |
||||
IMonthCn |
||||
} = this.getLunar(e.date) |
||||
e.lunar = IDayCn == '初一' ? IMonthCn : IDayCn |
||||
} |
||||
|
||||
return { |
||||
...e, |
||||
...custom |
||||
} |
||||
}) |
||||
) |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,14 +0,0 @@
|
||||
export default { |
||||
props: { |
||||
// 是否打乱键盘按键的顺序
|
||||
random: { |
||||
type: Boolean, |
||||
default: false |
||||
}, |
||||
// 输入一个中文后,是否自动切换到英文
|
||||
autoChange: { |
||||
type: Boolean, |
||||
default: false |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue