升级uni-ui到最新版本1.4.23

This commit is contained in:
RuoYi 2022-12-28 10:03:07 +08:00
parent 9bca5bebd5
commit 55fb5c5f61
52 changed files with 2907 additions and 2542 deletions

View File

@ -1,6 +1,7 @@
// 应用全局配置 // 应用全局配置
module.exports = { module.exports = {
baseUrl: 'http://localhost:8080', baseUrl: 'https://vue.ruoyi.vip/prod-api',
// baseUrl: 'http://localhost:8080',
// 应用信息 // 应用信息
appInfo: { appInfo: {
// 应用名称 // 应用名称

View File

@ -1,3 +1,5 @@
## 1.2.12022-09-05
- 修复 当 text 超过 max-num 时badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
## 1.2.02021-11-19 ## 1.2.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) - 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge) - 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge)

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="uni-badge--x"> <view class="uni-badge--x">
<slot /> <slot />
<text v-if="text" :class="classNames" :style="[badgeWidth, positionStyle, customStyle, dotStyle]" <text v-if="text" :class="classNames" :style="[positionStyle, customStyle, dotStyle]"
class="uni-badge" @click="onClick()">{{displayValue}}</text> class="uni-badge" @click="onClick()">{{displayValue}}</text>
</view> </view>
</template> </template>
@ -130,16 +130,13 @@
const match = whiteList[this.absolute] const match = whiteList[this.absolute]
return match ? match : whiteList['rightTop'] return match ? match : whiteList['rightTop']
}, },
badgeWidth() {
return {
width: `${this.width}px`
}
},
dotStyle() { dotStyle() {
if (!this.isDot) return {} if (!this.isDot) return {}
return { return {
width: '10px', width: '10px',
minWidth: '0',
height: '10px', height: '10px',
padding: '0',
borderRadius: '10px' borderRadius: '10px'
} }
}, },
@ -199,6 +196,8 @@
justify-content: center; justify-content: center;
flex-direction: row; flex-direction: row;
height: 20px; height: 20px;
min-width: 20px;
padding: 0 4px;
line-height: 18px; line-height: 18px;
color: #fff; color: #fff;
border-radius: 100px; border-radius: 100px;
@ -207,6 +206,7 @@
border: 1px solid #fff; border: 1px solid #fff;
text-align: center; text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif; font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-feature-settings: "tnum";
font-size: $bage-size; font-size: $bage-size;
/* #ifdef H5 */ /* #ifdef H5 */
z-index: 999; z-index: 999;

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-badge", "id": "uni-badge",
"displayName": "uni-badge 数字角标", "displayName": "uni-badge 数字角标",
"version": "1.2.0", "version": "1.2.1",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [ "keywords": [
"", "",
@ -19,10 +19,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -39,7 +35,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss"], "dependencies": ["uni-scss"],

View File

@ -1,3 +1,7 @@
## 1.4.72022-09-16
- 可以使用 uni-scss 控制主题色
## 1.4.62022-09-08
- fix: 表头年月切换导致改变当前日期为选择月1号且未触发change事件
## 1.4.52022-02-25 ## 1.4.52022-02-25
- 修复 条件编译 nvue 不支持的 css 样式 - 修复 条件编译 nvue 不支持的 css 样式
## 1.4.42022-02-25 ## 1.4.42022-02-25

View File

@ -102,7 +102,7 @@
$uni-color-error: #e43d33; $uni-color-error: #e43d33;
$uni-opacity-disabled: 0.3; $uni-opacity-disabled: 0.3;
$uni-text-color-disable:#c0c0c0; $uni-text-color-disable:#c0c0c0;
$uni-color-primary: #2979ff; $uni-primary: #2979ff !default;
.uni-calendar-item__weeks-box { .uni-calendar-item__weeks-box {
flex: 1; flex: 1;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@ -152,11 +152,11 @@
} }
.uni-calendar-item--isDay-text { .uni-calendar-item--isDay-text {
color: $uni-color-primary; color: $uni-primary;
} }
.uni-calendar-item--isDay { .uni-calendar-item--isDay {
background-color: $uni-color-primary; background-color: $uni-primary;
opacity: 0.8; opacity: 0.8;
color: #fff; color: #fff;
} }
@ -167,13 +167,13 @@
} }
.uni-calendar-item--checked { .uni-calendar-item--checked {
background-color: $uni-color-primary; background-color: $uni-primary;
color: #fff; color: #fff;
opacity: 0.8; opacity: 0.8;
} }
.uni-calendar-item--multiple { .uni-calendar-item--multiple {
background-color: $uni-color-primary; background-color: $uni-primary;
color: #fff; color: #fff;
opacity: 0.8; opacity: 0.8;
} }

View File

@ -218,7 +218,7 @@
bindDateChange(e) { bindDateChange(e) {
const value = e.detail.value + '-1' const value = e.detail.value + '-1'
console.log(this.cale.getDate(value)); console.log(this.cale.getDate(value));
this.init(value) this.setDate(value)
}, },
/** /**
* 初始化日期显示 * 初始化日期显示

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-calendar", "id": "uni-calendar",
"displayName": "uni-calendar 日历", "displayName": "uni-calendar 日历",
"version": "1.4.5", "version": "1.4.7",
"description": "日历组件", "description": "日历组件",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -19,10 +19,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -39,7 +35,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],

View File

@ -1,3 +1,5 @@
## 1.0.32022-09-16
- 可以使用 uni-scss 控制主题色
## 1.0.22022-06-30 ## 1.0.22022-06-30
- 优化 在 uni-forms 中的依赖注入方式 - 优化 在 uni-forms 中的依赖注入方式
## 1.0.12022-02-07 ## 1.0.12022-02-07

View File

@ -384,12 +384,14 @@
setStyleBackgroud(item) { setStyleBackgroud(item) {
let styles = {} let styles = {}
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff' let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
if (this.selectedColor) {
if (this.mode !== 'list') { if (this.mode !== 'list') {
styles['border-color'] = item.selected?selectedColor:'#DCDFE6' styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
} }
if (this.mode === 'tag') { if (this.mode === 'tag') {
styles['background-color'] = item.selected? selectedColor:'#f5f5f5' styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
} }
}
let classles = '' let classles = ''
for (let i in styles) { for (let i in styles) {
classles += `${i}:${styles[i]};` classles += `${i}:${styles[i]};`
@ -399,6 +401,7 @@
setStyleIcon(item) { setStyleIcon(item) {
let styles = {} let styles = {}
let classles = '' let classles = ''
if (this.selectedColor) {
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff' let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
styles['background-color'] = item.selected?selectedColor:'#fff' styles['background-color'] = item.selected?selectedColor:'#fff'
styles['border-color'] = item.selected?selectedColor:'#DCDFE6' styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
@ -407,7 +410,7 @@
styles['background-color'] = '#F2F6FC' styles['background-color'] = '#F2F6FC'
styles['border-color'] = item.selected?selectedColor:'#DCDFE6' styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
} }
}
for (let i in styles) { for (let i in styles) {
classles += `${i}:${styles[i]};` classles += `${i}:${styles[i]};`
} }
@ -416,6 +419,7 @@
setStyleIconText(item) { setStyleIconText(item) {
let styles = {} let styles = {}
let classles = '' let classles = ''
if (this.selectedColor) {
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff' let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
if (this.mode === 'tag') { if (this.mode === 'tag') {
styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666' styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
@ -425,7 +429,7 @@
if(!item.selected && item.disabled){ if(!item.selected && item.disabled){
styles.color = '#999' styles.color = '#999'
} }
}
for (let i in styles) { for (let i in styles) {
classles += `${i}:${styles[i]};` classles += `${i}:${styles[i]};`
} }
@ -448,7 +452,7 @@
</script> </script>
<style lang="scss"> <style lang="scss">
$checked-color: #2979ff; $uni-primary: #2979ff !default;
$border-color: #DCDFE6; $border-color: #DCDFE6;
$disable:0.4; $disable:0.4;
@ -614,8 +618,8 @@
// //
&.is-checked { &.is-checked {
.checkbox__inner { .checkbox__inner {
border-color: $checked-color; border-color: $uni-primary;
background-color: $checked-color; background-color: $uni-primary;
.checkbox__inner-icon { .checkbox__inner-icon {
opacity: 1; opacity: 1;
@ -623,14 +627,14 @@
} }
} }
.radio__inner { .radio__inner {
border-color: $checked-color; border-color: $uni-primary;
.radio__inner-icon { .radio__inner-icon {
opacity: 1; opacity: 1;
background-color: $checked-color; background-color: $uni-primary;
} }
} }
.checklist-text { .checklist-text {
color: $checked-color; color: $uni-primary;
} }
// //
&.is-disable { &.is-disable {
@ -683,10 +687,10 @@
} }
&.is-checked { &.is-checked {
border-color: $checked-color; border-color: $uni-primary;
.checkbox__inner { .checkbox__inner {
border-color: $checked-color; border-color: $uni-primary;
background-color: $checked-color; background-color: $uni-primary;
.checkbox__inner-icon { .checkbox__inner-icon {
opacity: 1; opacity: 1;
transform: rotate(45deg); transform: rotate(45deg);
@ -694,16 +698,16 @@
} }
.radio__inner { .radio__inner {
border-color: $checked-color; border-color: $uni-primary;
.radio__inner-icon { .radio__inner-icon {
opacity: 1; opacity: 1;
background-color: $checked-color; background-color: $uni-primary;
} }
} }
.checklist-text { .checklist-text {
color: $checked-color; color: $uni-primary;
} }
// //
@ -735,8 +739,8 @@
} }
&.is-checked { &.is-checked {
background-color: $checked-color; background-color: $uni-primary;
border-color: $checked-color; border-color: $uni-primary;
.checklist-text { .checklist-text {
color: #fff; color: #fff;
@ -775,8 +779,8 @@
&.is-checked { &.is-checked {
.checkbox__inner { .checkbox__inner {
border-color: $checked-color; border-color: $uni-primary;
background-color: $checked-color; background-color: $uni-primary;
.checkbox__inner-icon { .checkbox__inner-icon {
opacity: 1; opacity: 1;
@ -789,13 +793,13 @@
} }
} }
.checklist-text { .checklist-text {
color: $checked-color; color: $uni-primary;
} }
.checklist-content { .checklist-content {
.checkobx__list { .checkobx__list {
opacity: 1; opacity: 1;
border-color: $checked-color; border-color: $uni-primary;
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-data-checkbox", "id": "uni-data-checkbox",
"displayName": "uni-data-checkbox 数据选择器", "displayName": "uni-data-checkbox 数据选择器",
"version": "1.0.2", "version": "1.0.3",
"description": "通过数据驱动的单选框和复选框", "description": "通过数据驱动的单选框和复选框",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-load-more","uni-scss"], "dependencies": ["uni-load-more","uni-scss"],

View File

@ -1,3 +1,5 @@
## 1.0.82022-09-16
- 可以使用 uni-scss 控制主题色
## 1.0.72022-07-06 ## 1.0.72022-07-06
- 优化 pc端图标位置不正确的问题 - 优化 pc端图标位置不正确的问题
## 1.0.62022-07-05 ## 1.0.62022-07-05

View File

@ -16,8 +16,7 @@
</view> </view>
</scroll-view> </scroll-view>
<text v-else class="selected-area placeholder">{{placeholder}}</text> <text v-else class="selected-area placeholder">{{placeholder}}</text>
<view v-if="clearIcon && !readonly && inputSelected.length" class="icon-clear" <view v-if="clearIcon && !readonly && inputSelected.length" class="icon-clear" @click.stop="clear">
@click.stop="clear">
<uni-icons type="clear" color="#c0c4cc" size="24"></uni-icons> <uni-icons type="clear" color="#c0c4cc" size="24"></uni-icons>
</view> </view>
<view class="arrow-area" v-if="(!clearIcon || !inputSelected.length) && !readonly "> <view class="arrow-area" v-if="(!clearIcon || !inputSelected.length) && !readonly ">
@ -40,8 +39,8 @@
</view> </view>
<data-picker-view class="picker-view" ref="pickerView" v-model="dataValue" :localdata="localdata" <data-picker-view class="picker-view" ref="pickerView" v-model="dataValue" :localdata="localdata"
:preload="preload" :collection="collection" :field="field" :orderby="orderby" :where="where" :preload="preload" :collection="collection" :field="field" :orderby="orderby" :where="where"
:step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true" :step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true" :map="map"
:map="map" :ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick"> :ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick">
</data-picker-view> </data-picker-view>
</view> </view>
</view> </view>
@ -128,58 +127,46 @@
} }
}, },
created() { 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.$nextTick(() => {
this.load() this.load();
}) })
}, },
methods: { methods: {
clear() { clear() {
this.inputSelected.splice(0) this.modelValue = null;
this._dispatchEvent([]) this._dispatchEvent([]);
}, },
onPropsChange() { onPropsChange() {
this._treeData = [] this._treeData = [];
this.selectedIndex = 0 this.selectedIndex = 0;
this.load()
this.load();
}, },
load() { load() {
if (this.readonly) { if (this.readonly) {
this._processReadonly(this.localdata, this.dataValue) this._processReadonly(this.localdata, this.dataValue);
return return;
} }
if (this.isLocaldata) { if (!this.hasValue) {
this.loadData() return;
this.inputSelected = this.selected.slice(0) }
} else if (!this.parentField && !this.selfField && this.hasValue) {
this.getNodeData(() => { //
this.inputSelected = this.selected.slice(0) if (this.isLocalData) {
}) this.loadData();
} else if (this.hasValue) { this.inputSelected = this.selected.slice(0);
this.getTreePath(() => { } else if (this.isCloudDataList || this.isCloudDataTree) { // Cloud
this.inputSelected = this.selected.slice(0) this.loading = true;
this.getCloudDataValue().then((res) => {
this.loading = false;
this.inputSelected = res;
}).catch((err) => {
this.loading = false;
this.errorMessage = err;
}) })
} }
}, },
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() { show() {
this.isOpened = true this.isOpened = true
setTimeout(() => { setTimeout(() => {
@ -413,7 +400,12 @@
.uni-data-tree-dialog { .uni-data-tree-dialog {
position: fixed; position: fixed;
left: 0; left: 0;
/* #ifndef APP-NVUE */
top: 20%; top: 20%;
/* #endif */
/* #ifdef APP-NVUE */
top: 200px;
/* #endif */
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: #FFFFFF; background-color: #FFFFFF;
@ -550,5 +542,6 @@
border-top-width: 0; border-top-width: 0;
border-bottom-color: #fff; border-bottom-color: #fff;
} }
/* #endif */ /* #endif */
</style> </style>

View File

@ -42,7 +42,7 @@ export default {
}, },
pageSize: { pageSize: {
type: Number, type: Number,
default: 20 default: 500
}, },
getcount: { getcount: {
type: [Boolean, String], type: [Boolean, String],
@ -122,19 +122,22 @@ export default {
} }
}, },
computed: { computed: {
isLocaldata() { isLocalData() {
return !this.collection.length return !this.collection.length;
}, },
postField() { isCloudData() {
let fields = [this.field]; return this.collection.length > 0;
if (this.parentField) { },
fields.push(`${this.parentField} as parent_value`); isCloudDataList() {
} return (this.isCloudData && (!this.parentField && !this.selfField));
return fields.join(','); },
isCloudDataTree() {
return (this.isCloudData && this.parentField && this.selfField);
}, },
dataValue() { dataValue() {
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined) let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null ||
return isModelValue ? this.modelValue : this.value this.modelValue !== undefined);
return isModelValue ? this.modelValue : this.value;
}, },
hasValue() { hasValue() {
if (typeof this.dataValue === 'number') { if (typeof this.dataValue === 'number') {
@ -183,8 +186,169 @@ export default {
}, },
methods: { methods: {
onPropsChange() { onPropsChange() {
this._treeData = [] this._treeData = [];
}, },
// 填充 pickview 数据
async loadData() {
if (this.isLocalData) {
this.loadLocalData();
} else if (this.isCloudDataList) {
this.loadCloudDataList();
} else if (this.isCloudDataTree) {
this.loadCloudDataTree();
}
},
// 加载本地数据
async loadLocalData() {
this._treeData = [];
this._extractTree(this.localdata, this._treeData);
let 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);
},
// 加载 Cloud 数据 (单列)
async loadCloudDataList() {
if (this.loading) {
return;
}
this.loading = true;
try {
let response = await this.getCommand();
let responseData = response.result.data;
this._treeData = responseData;
this._updateBindData();
this._updateSelected();
this.onDataChange();
} catch (e) {
this.errorMessage = e;
} finally {
this.loading = false;
}
},
// 加载 Cloud 数据 (树形)
async loadCloudDataTree() {
if (this.loading) {
return;
}
this.loading = true;
try {
let commandOptions = {
field: this._cloudDataPostField(),
where: this._cloudDataTreeWhere()
};
if (this.gettree) {
commandOptions.startwith = `${this.selfField}=='${this.dataValue}'`;
}
let response = await this.getCommand(commandOptions);
let responseData = response.result.data;
this._treeData = responseData;
this._updateBindData();
this._updateSelected();
this.onDataChange();
} catch (e) {
this.errorMessage = e;
} finally {
this.loading = false;
}
},
// 加载 Cloud 数据 (节点)
async loadCloudDataNode(callback) {
if (this.loading) {
return;
}
this.loading = true;
try {
let commandOptions = {
field: this._cloudDataPostField(),
where: this._cloudDataNodeWhere()
};
let response = await this.getCommand(commandOptions);
let responseData = response.result.data;
callback(responseData);
} catch (e) {
this.errorMessage = e;
} finally {
this.loading = false;
}
},
// 回显 Cloud 数据
getCloudDataValue() {
if (this.isCloudDataList) {
return this.getCloudDataListValue();
}
if (this.isCloudDataTree) {
return this.getCloudDataTreeValue();
}
},
// 回显 Cloud 数据 (单列)
getCloudDataListValue() {
// 根据 field's as value标识匹配 where 条件
let where = [];
let whereField = this._getForeignKeyByField();
if (whereField) {
where.push(`${whereField} == '${this.dataValue}'`)
}
where = where.join(' || ');
if (this.where) {
where = `(${this.where}) && (${where})`
}
return this.getCommand({
field: this._cloudDataPostField(),
where
}).then((res) => {
this.selected = res.result.data;
return res.result.data;
});
},
// 回显 Cloud 数据 (树形)
getCloudDataTreeValue() {
return this.getCommand({
field: this._cloudDataPostField(),
getTreePath: {
startWith: `${this.selfField}=='${this.dataValue}'`
}
}).then((res) => {
let treePath = [];
this._extractTreePath(res.result.data, treePath);
this.selected = treePath;
return treePath;
});
},
getCommand(options = {}) { getCommand(options = {}) {
/* eslint-disable no-undef */ /* eslint-disable no-undef */
let db = uniCloud.database(this.spaceInfo) let db = uniCloud.database(this.spaceInfo)
@ -229,125 +393,16 @@ export default {
return db return db
}, },
getNodeData(callback) {
if (this.loading) { _cloudDataPostField() {
return let fields = [this.field];
if (this.parentField) {
fields.push(`${this.parentField} as parent_value`);
} }
this.loading = true return fields.join(',');
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({ _cloudDataTreeWhere() {
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 result = []
let selected = this.selected let selected = this.selected
let parentField = this.parentField let parentField = this.parentField
@ -364,17 +419,35 @@ export default {
if (this.where) { if (this.where) {
where.push(`(${this.where})`) where.push(`(${this.where})`)
} }
if (result.length) { if (result.length) {
where.push(`(${result.join(' || ')})`) where.push(`(${result.join(' || ')})`)
} }
return where.join(' && ') return where.join(' && ')
}, },
_nodeWhere() {
let result = [] _cloudDataNodeWhere() {
let selected = this.selected let where = []
let selected = this.selected;
if (selected.length) { if (selected.length) {
result.push(`${this.parentField} == '${selected[selected.length - 1].value}'`) where.push(`${this.parentField} == '${selected[selected.length - 1].value}'`);
}
where = where.join(' || ');
if (this.where) {
return `(${this.where}) && (${where})`
}
return where
},
_getWhereByForeignKey() {
let result = []
let whereField = this._getForeignKeyByField();
if (whereField) {
result.push(`${whereField} == '${this.dataValue}'`)
} }
if (this.where) { if (this.where) {
@ -383,41 +456,23 @@ export default {
return result.join(' || ') return result.join(' || ')
}, },
_getParentNameByField() {
const fields = this.field.split(','); _getForeignKeyByField() {
let where_field = null; let fields = this.field.split(',');
let whereField = null;
for (let i = 0; i < fields.length; i++) { for (let i = 0; i < fields.length; i++) {
const items = fields[i].split('as'); const items = fields[i].split('as');
if (items.length < 2) { if (items.length < 2) {
continue; continue;
} }
if (items[1].trim() === 'value') { if (items[1].trim() === 'value') {
where_field = items[0].trim(); whereField = items[0].trim();
break; break;
} }
} }
return where_field return whereField;
},
_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) { _updateBindData(node) {
const { const {
dataList, dataList,
@ -445,6 +500,25 @@ export default {
hasNodes hasNodes
} }
}, },
_updateSelected() {
let dl = this.dataList
let sl = this.selected
let textField = this.map.text
let valueField = this.map.value
for (let i = 0; i < sl.length; i++) {
let value = sl[i].value
let dl2 = dl[i]
for (let j = 0; j < dl2.length; j++) {
let item2 = dl2[j]
if (item2[valueField] === value) {
sl[i].text = item2[textField]
break
}
}
}
},
_filterData(data, paths) { _filterData(data, paths) {
let dataList = [] let dataList = []
let hasNodes = true let hasNodes = true
@ -453,8 +527,8 @@ export default {
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '') return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
})) }))
for (let i = 0; i < paths.length; i++) { for (let i = 0; i < paths.length; i++) {
var value = paths[i].value let value = paths[i].value
var nodes = data.filter((item) => { let nodes = data.filter((item) => {
return item.parent_value === value return item.parent_value === value
}) })
@ -470,6 +544,7 @@ export default {
hasNodes hasNodes
} }
}, },
_extractTree(nodes, result, parent_value) { _extractTree(nodes, result, parent_value) {
let list = result || [] let list = result || []
let valueField = this.map.value let valueField = this.map.value
@ -493,6 +568,7 @@ export default {
} }
} }
}, },
_extractTreePath(nodes, result) { _extractTreePath(nodes, result) {
let list = result || [] let list = result || []
for (let i = 0; i < nodes.length; i++) { for (let i = 0; i < nodes.length; i++) {
@ -512,6 +588,7 @@ export default {
} }
} }
}, },
_findNodePath(key, nodes, path = []) { _findNodePath(key, nodes, path = []) {
let textField = this.map.text let textField = this.map.text
let valueField = this.map.value let valueField = this.map.value
@ -540,24 +617,6 @@ export default {
path.pop() path.pop()
} }
return [] 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)
} }
} }
} }

View File

@ -1,12 +1,12 @@
<template> <template>
<view class="uni-data-pickerview"> <view class="uni-data-pickerview">
<scroll-view class="selected-area" scroll-x="true" scroll-y="false" :show-scrollbar="false"> <scroll-view v-if="!isCloudDataList" class="selected-area" scroll-x="true">
<view class="selected-list"> <view class="selected-list">
<template v-for="(item,index) in selected"> <template v-for="(item,index) in selected">
<view class="selected-item" <view class="selected-item"
:class="{'selected-item-active':index==selectedIndex, 'selected-item-text-overflow': ellipsis}" :class="{'selected-item-active':index==selectedIndex}"
v-if="item.text" @click="handleSelect(index)"> v-if="item.text" @click="handleSelect(index)">
<text class="">{{item.text}}</text> <text>{{item.text}}</text>
</view> </view>
</template> </template>
</view> </view>
@ -16,7 +16,7 @@
<scroll-view class="list" :key="i" v-if="i==selectedIndex" :scroll-y="true"> <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" <view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in child"
@click="handleNodeClick(item, i, j)"> @click="handleNodeClick(item, i, j)">
<text class="item-text item-text-overflow">{{item[map.text]}}</text> <text class="item-text">{{item[map.text]}}</text>
<view class="check" v-if="selected.length > i && item[map.value] == selected[i].value"></view> <view class="check" v-if="selected.length > i && item[map.value] == selected[i].value"></view>
</view> </view>
</scroll-view> </scroll-view>
@ -64,43 +64,33 @@
default: true default: true
} }
}, },
data() {
return {}
},
created() { created() {
if (this.managedMode) { if (!this.managedMode) {
return
}
this.$nextTick(() => { this.$nextTick(() => {
this.load() this.loadData();
}) })
}
}, },
methods: { methods: {
onPropsChange() { onPropsChange() {
this._treeData = [] this._treeData = [];
this.selectedIndex = 0 this.selectedIndex = 0;
this.load() this.$nextTick(() => {
}, this.loadData();
load() {
if (this.isLocaldata) {
this.loadData()
} else if (this.dataValue.length) {
this.getTreePath((res) => {
this.loadData()
}) })
}
}, },
handleSelect(index) { handleSelect(index) {
this.selectedIndex = index this.selectedIndex = index;
}, },
handleNodeClick(item, i, j) { handleNodeClick(item, i, j) {
if (item.disable) { if (item.disable) {
return return;
} }
const node = this.dataList[i][j]
const text = node[this.map.text] const node = this.dataList[i][j];
const value = node[this.map.value] const text = node[this.map.text];
const value = node[this.map.value];
if (i < this.selected.length - 1) { if (i < this.selected.length - 1) {
this.selected.splice(i, this.selected.length - i) this.selected.splice(i, this.selected.length - i)
this.selected.push({ this.selected.push({
@ -124,18 +114,16 @@
hasNodes hasNodes
} = this._updateBindData() } = this._updateBindData()
if (!this._isTreeView() && !hasNodes) { //
if (this.isLocalData) {
this.onSelectedChange(node, (!hasNodes || isleaf))
} else if (this.isCloudDataList) { // Cloud ()
this.onSelectedChange(node, true) this.onSelectedChange(node, true)
return } else if (this.isCloudDataTree) { // Cloud ()
} if (isleaf) {
this.onSelectedChange(node, node.isleaf)
if (this.isLocaldata && (!hasNodes || isleaf)) { } else if (!hasNodes) { //
this.onSelectedChange(node, true) this.loadCloudDataNode((data) => {
return
}
if (!isleaf && !hasNodes) {
this._loadNodeData((data) => {
if (!data.length) { if (!data.length) {
node.isleaf = true node.isleaf = true
} else { } else {
@ -143,11 +131,9 @@
this._updateBindData(node) this._updateBindData(node)
} }
this.onSelectedChange(node, node.isleaf) this.onSelectedChange(node, node.isleaf)
}, this._nodeWhere()) })
return }
} }
this.onSelectedChange(node, false)
}, },
updateData(data) { updateData(data) {
this._treeData = data.treeData this._treeData = data.treeData
@ -160,7 +146,7 @@
} }
}, },
onDataChange() { onDataChange() {
this.$emit('datachange') this.$emit('datachange');
}, },
onSelectedChange(node, isleaf) { onSelectedChange(node, isleaf) {
if (isleaf) { if (isleaf) {
@ -177,7 +163,10 @@
} }
} }
</script> </script>
<style >
<style lang="scss">
$uni-primary: #007aff !default;
.uni-data-pickerview { .uni-data-pickerview {
flex: 1; flex: 1;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@ -229,15 +218,14 @@
.selected-area { .selected-area {
width: 750rpx; width: 750rpx;
} }
/* #endif */ /* #endif */
.selected-list { .selected-list {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
flex-wrap: nowrap;
/* #endif */ /* #endif */
flex-direction: row; flex-direction: row;
flex-wrap: nowrap;
padding: 0 5px; padding: 0 5px;
border-bottom: 1px solid #f8f8f8; border-bottom: 1px solid #f8f8f8;
} }
@ -265,11 +253,11 @@
} }
.selected-item-active { .selected-item-active {
border-bottom: 2px solid #007aff; border-bottom: 2px solid $uni-primary;
} }
.selected-item-text { .selected-item-text {
color: #007aff; color: $uni-primary;
} }
.tab-c { .tab-c {
@ -319,7 +307,7 @@
.check { .check {
margin-right: 5px; margin-right: 5px;
border: 2px solid #007aff; border: 2px solid $uni-primary;
border-left: 0; border-left: 0;
border-top: 0; border-top: 0;
height: 12px; height: 12px;

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-data-picker", "id": "uni-data-picker",
"displayName": "uni-data-picker 数据驱动的picker选择器", "displayName": "uni-data-picker 数据驱动的picker选择器",
"version": "1.0.7", "version": "1.0.8",
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景", "description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -19,10 +19,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -39,7 +35,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [
@ -56,7 +53,7 @@
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "u"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",

View File

@ -1,3 +1,9 @@
## 0.1.92022-09-05
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.82022-08-29
- 修复 点击的位置不准确
## 0.1.72022-08-12
- 新增 支持 disabled 属性
## 0.1.62022-07-06 ## 0.1.62022-07-06
- 修复 pc端宽度异常的bug - 修复 pc端宽度异常的bug
## 0.1.5 ## 0.1.5

View File

@ -2,7 +2,7 @@
<view class="uni-stat__select"> <view class="uni-stat__select">
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ''}}</span> <span v-if="label" class="uni-label-text hide-on-phone">{{label + ''}}</span>
<view class="uni-stat-box" :class="{'uni-stat__actived': current}"> <view class="uni-stat-box" :class="{'uni-stat__actived': current}">
<view class="uni-select"> <view class="uni-select" :class="{'uni-select--disabled':disabled}">
<view class="uni-select__input-box" @click="toggleSelector"> <view class="uni-select__input-box" @click="toggleSelector">
<view v-if="current" class="uni-select__input-text">{{current}}</view> <view v-if="current" class="uni-select__input-text">{{current}}</view>
<view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view> <view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
@ -39,6 +39,7 @@
* @property {Boolean} emptyText 没有数据时显示的文字 本地数据无效 * @property {Boolean} emptyText 没有数据时显示的文字 本地数据无效
* @property {String} label 左侧标题 * @property {String} label 左侧标题
* @property {String} placeholder 输入框的提示文字 * @property {String} placeholder 输入框的提示文字
* @property {Boolean} disabled 是否禁用
* @event {Function} change 选中发生变化触发 * @event {Function} change 选中发生变化触发
*/ */
@ -88,6 +89,10 @@
defItem: { defItem: {
type: Number, type: Number,
default: 0 default: 0
},
disabled: {
type: Boolean,
default: false
} }
}, },
created() { created() {
@ -204,6 +209,10 @@
}, },
toggleSelector() { toggleSelector() {
if(this.disabled){
return
}
this.showSelector = !this.showSelector this.showSelector = !this.showSelector
}, },
formatItemName(item) { formatItemName(item) {
@ -287,6 +296,11 @@
width: 100%; width: 100%;
flex: 1; flex: 1;
height: 35px; height: 35px;
&--disabled{
background-color: #f5f7fa;
cursor: not-allowed;
}
} }
.uni-select__label { .uni-select__label {
@ -298,7 +312,7 @@
} }
.uni-select__input-box { .uni-select__input-box {
// height: 35px; height: 35px;
position: relative; position: relative;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -332,7 +346,7 @@
border: 1px solid #EBEEF5; border: 1px solid #EBEEF5;
border-radius: 6px; border-radius: 6px;
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
z-index: 2; z-index: 3;
padding: 4px 0; padding: 4px 0;
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-data-select", "id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器", "displayName": "uni-data-select 下拉框选择器",
"version": "0.1.6", "version": "0.1.9",
"description": "通过数据驱动的下拉框选择器", "description": "通过数据驱动的下拉框选择器",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-load-more"], "dependencies": ["uni-load-more"],

View File

@ -1,3 +1,13 @@
## 2.2.112022-09-19
- 修复,支付宝小程序样式错乱,[详情](https://github.com/dcloudio/uni-app/issues/3861)
## 2.2.102022-09-19
- 修复,反向选择日期范围,日期显示异常,[详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false)
## 2.2.92022-09-16
- 可以使用 uni-scss 控制主题色
## 2.2.82022-09-08
- 修复 close事件无效的 bug
## 2.2.72022-09-05
- 修复 移动端 maskClick 无效的 bug详见:[https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false](https://ask.dcloud.net.cn/question/140824?item_id=209458&rf=false)
## 2.2.62022-06-30 ## 2.2.62022-06-30
- 优化 组件样式调整了组件图标大小、高度、颜色等与uni-ui风格保持一致 - 优化 组件样式调整了组件图标大小、高度、颜色等与uni-ui风格保持一致
## 2.2.52022-06-24 ## 2.2.52022-06-24

View File

@ -62,6 +62,8 @@
</script> </script>
<style lang="scss" > <style lang="scss" >
$uni-primary: #007aff !default;
.uni-calendar-item__weeks-box { .uni-calendar-item__weeks-box {
flex: 1; flex: 1;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@ -78,7 +80,7 @@
font-size: 14px; font-size: 14px;
// font-family: Lato-Bold, Lato; // font-family: Lato-Bold, Lato;
font-weight: bold; font-weight: bold;
color: #455997; color: darken($color: $uni-primary, $amount: 40%);
} }
.uni-calendar-item__weeks-lunar-text { .uni-calendar-item__weeks-lunar-text {
@ -138,7 +140,7 @@
} }
.uni-calendar-item__weeks-box .uni-calendar-item--checked { .uni-calendar-item__weeks-box .uni-calendar-item--checked {
background-color: #007aff; background-color: $uni-primary;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
border: 3px solid #fff; border: 3px solid #fff;
@ -159,7 +161,7 @@
.uni-calendar-item--multiple .uni-calendar-item--before-checked, .uni-calendar-item--multiple .uni-calendar-item--before-checked,
.uni-calendar-item--multiple .uni-calendar-item--after-checked { .uni-calendar-item--multiple .uni-calendar-item--after-checked {
background-color: #409eff; background-color: $uni-primary;
border-radius: 50%; border-radius: 50%;
box-sizing: border-box; box-sizing: border-box;
border: 3px solid #F6F7FC; border: 3px solid #F6F7FC;

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="uni-calendar" @mouseleave="leaveCale"> <view class="uni-calendar" @mouseleave="leaveCale">
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" <view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}"
@click="clean"></view> @click="clean();maskClick()"></view>
<view v-if="insert || show" class="uni-calendar__content" <view v-if="insert || show" class="uni-calendar__content"
:class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}"> :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow, 'uni-calendar__content-mobile': aniMaskShow}">
<view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}"> <view class="uni-calendar__header" :class="{'uni-calendar__header-mobile' :!insert}">
@ -74,7 +74,9 @@
:hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style"> :hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style">
</time-picker> </time-picker>
</view> </view>
<uni-icons type="arrowthinright" color="#999" style="line-height: 50px;"></uni-icons> <view style="line-height: 50px;">
<uni-icons type="arrowthinright" color="#999"></uni-icons>
</view>
<view class="uni-date-changed--time-end"> <view class="uni-date-changed--time-end">
<view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view> <view class="uni-date-changed--time-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
<time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false" <time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false"
@ -411,6 +413,11 @@
this.close() this.close()
}, },
//
maskClick() {
this.$emit('maskClose')
},
clearCalender() { clearCalender() {
if (this.range) { if (this.range) {
this.timeRange.startTime = '' this.timeRange.startTime = ''
@ -546,8 +553,16 @@
this.cale.setMultiple(this.calendar.fullDate, true) this.cale.setMultiple(this.calendar.fullDate, true)
this.weeks = this.cale.weeks this.weeks = this.cale.weeks
this.tempSingleDate = this.calendar.fullDate this.tempSingleDate = this.calendar.fullDate
const beforeStatus = this.cale.multipleStatus.before
const beforeDate = new Date(this.cale.multipleStatus.before).getTime()
const afterDate = new Date(this.cale.multipleStatus.after).getTime()
if (beforeDate > afterDate && afterDate) {
this.tempRange.before = this.cale.multipleStatus.after
this.tempRange.after = this.cale.multipleStatus.before
} else {
this.tempRange.before = this.cale.multipleStatus.before this.tempRange.before = this.cale.multipleStatus.before
this.tempRange.after = this.cale.multipleStatus.after this.tempRange.after = this.cale.multipleStatus.after
}
this.change() this.change()
}, },
/** /**
@ -604,6 +619,8 @@
</script> </script>
<style lang="scss" > <style lang="scss" >
$uni-primary: #007aff !default;
.uni-calendar { .uni-calendar {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -714,7 +731,7 @@
text-align: center; text-align: center;
width: 100px; width: 100px;
font-size: 14px; font-size: 14px;
color: #007aff; color: $uni-primary;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
letter-spacing: 3px; letter-spacing: 3px;
/* #endif */ /* #endif */
@ -893,7 +910,7 @@
border-radius: 100px; border-radius: 100px;
height: 40px; height: 40px;
line-height: 40px; line-height: 40px;
background-color: #007aff; background-color: $uni-primary;
color: #fff; color: #fff;
font-size: 16px; font-size: 16px;
letter-spacing: 2px; letter-spacing: 2px;

View File

@ -185,6 +185,7 @@
} }
}, },
watch: { watch: {
// #ifndef VUE3
value: { value: {
handler(newVal, oldVal) { handler(newVal, oldVal) {
if (newVal) { if (newVal) {
@ -197,6 +198,21 @@
}, },
immediate: true immediate: true
}, },
// #endif
// #ifdef VUE3
modelValue: {
handler(newVal, oldVal) {
if (newVal) {
this.parseValue(this.fixIosDateFormat(newVal)) // iOSsafari
this.initTime(false)
} else {
this.time = ''
this.parseValue(Date.now())
}
},
immediate: true
},
// #endif
type: { type: {
handler(newValue) { handler(newValue) {
if (newValue === 'date') { if (newValue === 'date') {
@ -770,7 +786,9 @@
} }
</script> </script>
<style> <style lang="scss">
$uni-primary: #007aff !default;
.uni-datetime-picker { .uni-datetime-picker {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
/* width: 100%; */ /* width: 100%; */
@ -804,7 +822,7 @@
.uni-datetime-picker-btn-text { .uni-datetime-picker-btn-text {
font-size: 14px; font-size: 14px;
color: #007AFF; color: $uni-primary;
} }
.uni-datetime-picker-btn-group { .uni-datetime-picker-btn-group {
@ -889,6 +907,7 @@
.uni-datetime-picker-text { .uni-datetime-picker-text {
font-size: 14px; font-size: 14px;
line-height: 50px
} }
.uni-datetime-picker-sign { .uni-datetime-picker-sign {

View File

@ -91,7 +91,7 @@
<calendar v-show="isPhone" ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime" <calendar v-show="isPhone" ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime"
:start-date="caleRange.startDate" :end-date="caleRange.endDate" :selectableTimes="mobSelectableTime" :start-date="caleRange.startDate" :end-date="caleRange.endDate" :selectableTimes="mobSelectableTime"
:pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :typeHasTime="hasTime" :insert="false" :pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :typeHasTime="hasTime" :insert="false"
:hideSecond="hideSecond" @confirm="mobileChange" /> :hideSecond="hideSecond" @confirm="mobileChange" @maskClose="close" />
</view> </view>
</template> </template>
<script> <script>
@ -516,6 +516,7 @@
setTimeout(() => { setTimeout(() => {
this.popup = false this.popup = false
this.$emit('maskClick', this.value) this.$emit('maskClick', this.value)
this.$refs.mobile.close()
}, 20) }, 20)
}, },
setEmit(value) { setEmit(value) {
@ -782,7 +783,9 @@
} }
</script> </script>
<style> <style lang="scss">
$uni-primary: #007aff !default;
.uni-date { .uni-date {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
width: 100%; width: 100%;
@ -941,14 +944,14 @@
} }
.popup-x-footer text:hover { .popup-x-footer text:hover {
color: #007aff; color: $uni-primary;
cursor: pointer; cursor: pointer;
opacity: 0.8; opacity: 0.8;
} }
.popup-x-footer .confirm { .popup-x-footer .confirm {
margin-left: 20px; margin-left: 20px;
color: #007aff; color: $uni-primary;
} }
.uni-date-changed { .uni-date-changed {

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-datetime-picker", "id": "uni-datetime-picker",
"displayName": "uni-datetime-picker 日期选择器", "displayName": "uni-datetime-picker 日期选择器",
"version": "2.2.6", "version": "2.2.11",
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择", "description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
"keywords": [ "keywords": [
"uni-datetime-picker", "uni-datetime-picker",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [

View File

@ -1,47 +1,86 @@
## 1.1.02022-06-30 ## 1.1.02022-06-30
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容 - 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
- 新增 clear 事件,点击右侧叉号图标触发 - 新增 clear 事件,点击右侧叉号图标触发
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发 - 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等 - 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
- -
## 1.0.52022-06-07 ## 1.0.52022-06-07
- 优化 clearable 显示策略 - 优化 clearable 显示策略
## 1.0.42022-06-07 ## 1.0.42022-06-07
- 优化 clearable 显示策略 - 优化 clearable 显示策略
## 1.0.32022-05-20 ## 1.0.32022-05-20
- 修复 关闭图标某些情况下无法取消的 bug - 修复 关闭图标某些情况下无法取消的 bug
## 1.0.22022-04-12 ## 1.0.22022-04-12
- 修复 默认值不生效的 bug - 修复 默认值不生效的 bug
## 1.0.12022-04-02 ## 1.0.12022-04-02
- 修复 value 不能为 0 的 bug - 修复 value 不能为 0 的 bug
## 1.0.02021-11-19 ## 1.0.02021-11-19
- 优化 组件 UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) - 优化 组件 UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput) - 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-easyinput](https://uniapp.dcloud.io/component/uniui/uni-easyinput)
## 0.1.42021-08-20 ## 0.1.42021-08-20
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug - 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
## 0.1.32021-08-11 ## 0.1.32021-08-11
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题 - 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
## 0.1.22021-07-30 ## 0.1.22021-07-30
- 优化 vue3 下事件警告的问题 - 优化 vue3 下事件警告的问题
## 0.1.1 ## 0.1.1
- 优化 errorMessage 属性支持 Boolean 类型 - 优化 errorMessage 属性支持 Boolean 类型
## 0.1.02021-07-13 ## 0.1.02021-07-13
- 组件兼容 vue3如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3如何创建 vue3 项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 0.0.162021-06-29 ## 0.0.162021-06-29
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug - 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
## 0.0.152021-06-21 ## 0.0.152021-06-21
- 修复 passwordIcon 属性拼写错误的 bug - 修复 passwordIcon 属性拼写错误的 bug
## 0.0.142021-06-18 ## 0.0.142021-06-18
- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标 - 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标
- 修复 confirmType 属性不生效的问题 - 修复 confirmType 属性不生效的问题
## 0.0.132021-06-04 ## 0.0.132021-06-04
- 修复 disabled 状态可清出内容的 bug - 修复 disabled 状态可清出内容的 bug
## 0.0.122021-05-12 ## 0.0.122021-05-12
- 新增 组件示例地址 - 新增 组件示例地址
## 0.0.112021-05-07 ## 0.0.112021-05-07
- 修复 input-border 属性不生效的问题 - 修复 input-border 属性不生效的问题
## 0.0.102021-04-30 ## 0.0.102021-04-30
- 修复 ios 遮挡文字、显示一半的问题 - 修复 ios 遮挡文字、显示一半的问题
## 0.0.92021-02-05 ## 0.0.92021-02-05
- 调整为 uni_modules 目录规范 - 调整为 uni_modules 目录规范
- 优化 兼容 nvue 页面 - 优化 兼容 nvue 页面

View File

@ -1,34 +1,97 @@
<template> <template>
<view class="uni-easyinput" :class="{'uni-easyinput-error':msg}" :style="boxStyle"> <view
<view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle"> class="uni-easyinput"
<uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc" :class="{ 'uni-easyinput-error': msg }"
@click="onClickIcon('prefix')" size="22"></uni-icons> :style="boxStyle"
<textarea v-if="type === 'textarea'" class="uni-easyinput__content-textarea" >
:class="{'input-padding':inputBorder}" :name="name" :value="val" :placeholder="placeholder" <view
:placeholderStyle="placeholderStyle" :disabled="disabled" class="uni-easyinput__content"
placeholder-class="uni-easyinput__placeholder-class" :maxlength="inputMaxlength" :focus="focused" :class="inputContentClass"
:autoHeight="autoHeight" @input="onInput" @blur="_Blur" @focus="_Focus" @confirm="onConfirm"></textarea> :style="inputContentStyle"
<input v-else :type="type === 'password'?'text':type" class="uni-easyinput__content-input" >
:style="inputStyle" :name="name" :value="val" :password="!showPassword && type === 'password'" <slot name="prefixIcon">
:placeholder="placeholder" :placeholderStyle="placeholderStyle" <uni-icons
placeholder-class="uni-easyinput__placeholder-class" :disabled="disabled" :maxlength="inputMaxlength" v-if="prefixIcon"
:focus="focused" :confirmType="confirmType" @focus="_Focus" @blur="_Blur" @input="onInput" class="content-clear-icon"
@confirm="onConfirm" /> :type="prefixIcon"
color="#c0c4cc"
@click="onClickIcon('prefix')"
size="22"
></uni-icons>
</slot>
<textarea
v-if="type === 'textarea'"
class="uni-easyinput__content-textarea"
:class="{ 'input-padding': inputBorder }"
:name="name"
:value="val"
:placeholder="placeholder"
:placeholderStyle="placeholderStyle"
:disabled="disabled"
placeholder-class="uni-easyinput__placeholder-class"
:maxlength="inputMaxlength"
:focus="focused"
:autoHeight="autoHeight"
@input="onInput"
@blur="_Blur"
@focus="_Focus"
@confirm="onConfirm"
></textarea>
<input
v-else
:type="type === 'password' ? 'text' : type"
class="uni-easyinput__content-input"
:style="inputStyle"
:name="name"
:value="val"
:password="!showPassword && type === 'password'"
:placeholder="placeholder"
:placeholderStyle="placeholderStyle"
placeholder-class="uni-easyinput__placeholder-class"
:disabled="disabled"
:maxlength="inputMaxlength"
:focus="focused"
:confirmType="confirmType"
@focus="_Focus"
@blur="_Blur"
@input="onInput"
@confirm="onConfirm"
/>
<template v-if="type === 'password' && passwordIcon"> <template v-if="type === 'password' && passwordIcon">
<!-- 开启密码时显示小眼睛 --> <!-- 开启密码时显示小眼睛 -->
<uni-icons v-if="isVal" class="content-clear-icon" :class="{'is-textarea-icon':type==='textarea'}" <uni-icons
:type="showPassword?'eye-slash-filled':'eye-filled'" :size="22" v-if="isVal"
:color="focusShow?'#2979ff':'#c0c4cc'" @click="onEyes"> class="content-clear-icon"
:class="{ 'is-textarea-icon': type === 'textarea' }"
:type="showPassword ? 'eye-slash-filled' : 'eye-filled'"
:size="22"
:color="focusShow ? primaryColor : '#c0c4cc'"
@click="onEyes"
>
</uni-icons> </uni-icons>
</template> </template>
<template v-else-if="suffixIcon"> <template v-else-if="suffixIcon || $slots.suffixIcon">
<uni-icons v-if="suffixIcon" class="content-clear-icon" :type="suffixIcon" color="#c0c4cc" <slot name="suffixIcon">
@click="onClickIcon('suffix')" size="22"></uni-icons> <uni-icons
v-if="suffixIcon"
class="content-clear-icon"
:type="suffixIcon"
color="#c0c4cc"
@click="onClickIcon('suffix')"
size="22"
></uni-icons>
</slot>
</template> </template>
<template v-else> <template v-else>
<uni-icons v-if="clearable && isVal && !disabled && type !== 'textarea'" class="content-clear-icon" <uni-icons
:class="{'is-textarea-icon':type==='textarea'}" type="clear" :size="clearSize" v-if="clearable && isVal && !disabled && type !== 'textarea'"
:color="msg?'#dd524d':(focusShow?'#2979ff':'#c0c4cc')" @click="onClear"></uni-icons> class="content-clear-icon"
:class="{ 'is-textarea-icon': type === 'textarea' }"
type="clear"
:size="clearSize"
:color="msg ? '#dd524d' : focusShow ? primaryColor : '#c0c4cc'"
@click="onClear"
></uni-icons>
</template> </template>
<slot name="right"></slot> <slot name="right"></slot>
</view> </view>
@ -59,6 +122,7 @@
* @property {Number } clearSize 清除图标的大小单位px默认15 * @property {Number } clearSize 清除图标的大小单位px默认15
* @property {String} prefixIcon 输入框头部图标 * @property {String} prefixIcon 输入框头部图标
* @property {String} suffixIcon 输入框尾部图标 * @property {String} suffixIcon 输入框尾部图标
* @property {String} primaryColor 设置主题色默认#2979ff
* @property {Boolean} trim 是否自动去除两端的空格 * @property {Boolean} trim 是否自动去除两端的空格
* @value both 去除两端空格 * @value both 去除两端空格
* @value left 去除左侧空格 * @value left 去除左侧空格
@ -75,45 +139,58 @@
* @event {Function} blur 输入框失去焦点时触发 * @event {Function} blur 输入框失去焦点时触发
* @event {Function} confirm 点击完成按钮时触发 * @event {Function} confirm 点击完成按钮时触发
* @event {Function} iconClick 点击图标时触发 * @event {Function} iconClick 点击图标时触发
* @slot prefixIcon 输入框头部插槽
* @slot suffixIcon 输入框尾部插槽
* @example <uni-easyinput v-model="mobile"></uni-easyinput> * @example <uni-easyinput v-model="mobile"></uni-easyinput>
*/ */
function obj2strClass(obj) { function obj2strClass(obj) {
let classess = '' let classess = "";
for (let key in obj) { for (let key in obj) {
const val = obj[key] const val = obj[key];
if (val) { if (val) {
classess += `${key} ` classess += `${key} `;
} }
} }
return classess return classess;
} }
function obj2strStyle(obj) { function obj2strStyle(obj) {
let style = '' let style = "";
for (let key in obj) { for (let key in obj) {
const val = obj[key] const val = obj[key];
style += `${key}:${val};` style += `${key}:${val};`;
} }
return style return style;
} }
export default { export default {
name: 'uni-easyinput', name: "uni-easyinput",
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change'], emits: [
"click",
"iconClick",
"update:modelValue",
"input",
"focus",
"blur",
"confirm",
"clear",
"eyes",
"change",
],
model: { model: {
prop: 'modelValue', prop: "modelValue",
event: 'update:modelValue' event: "update:modelValue",
}, },
options: { options: {
virtualHost: true virtualHost: true,
}, },
inject: { inject: {
form: { form: {
from: 'uniForm', from: "uniForm",
default: null default: null,
}, },
formItem: { formItem: {
from: 'uniFormItem', from: "uniFormItem",
default: null default: null,
}, },
}, },
props: { props: {
@ -122,98 +199,102 @@
modelValue: [Number, String], modelValue: [Number, String],
type: { type: {
type: String, type: String,
default: 'text' default: "text",
}, },
clearable: { clearable: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
autoHeight: { autoHeight: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
placeholder: { placeholder: {
type: String, type: String,
default: ' ' default: " ",
}, },
placeholderStyle: String, placeholderStyle: String,
focus: { focus: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false default: false,
}, },
maxlength: { maxlength: {
type: [Number, String], type: [Number, String],
default: 140 default: 140,
}, },
confirmType: { confirmType: {
type: String, type: String,
default: 'done' default: "done",
}, },
clearSize: { clearSize: {
type: [Number, String], type: [Number, String],
default: 24 default: 24,
}, },
inputBorder: { inputBorder: {
type: Boolean, type: Boolean,
default: true default: true,
}, },
prefixIcon: { prefixIcon: {
type: String, type: String,
default: '' default: "",
}, },
suffixIcon: { suffixIcon: {
type: String, type: String,
default: '' default: "",
}, },
trim: { trim: {
type: [Boolean, String], type: [Boolean, String],
default: true default: true,
}, },
passwordIcon: { passwordIcon: {
type: Boolean, type: Boolean,
default: true default: true,
},
primaryColor: {
type: String,
default: "#2979ff",
}, },
styles: { styles: {
type: Object, type: Object,
default() { default() {
return { return {
color: '#333', color: "#333",
disableColor: '#F7F6F6', disableColor: "#F7F6F6",
borderColor: '#e5e5e5' borderColor: "#e5e5e5",
} };
} },
}, },
errorMessage: { errorMessage: {
type: [String, Boolean], type: [String, Boolean],
default: '' default: "",
} },
}, },
data() { data() {
return { return {
focused: false, focused: false,
val: '', val: "",
showMsg: '', showMsg: "",
border: false, border: false,
isFirstBorder: false, isFirstBorder: false,
showClearIcon: false, showClearIcon: false,
showPassword: false, showPassword: false,
focusShow: false, focusShow: false,
localMsg: '' localMsg: "",
}; };
}, },
computed: { computed: {
// //
isVal() { isVal() {
const val = this.val const val = this.val;
// fixed by mehaotian 00 // fixed by mehaotian 00
if (val || val === 0) { if (val || val === 0) {
return true return true;
} }
return false return false;
}, },
msg() { msg() {
@ -222,7 +303,7 @@
// return this.errorMessage || this.formItem.errMsg; // return this.errorMessage || this.formItem.errMsg;
// } // }
// TODO formItem errMsg // TODO formItem errMsg
return this.localMsg || this.errorMessage return this.localMsg || this.errorMessage;
}, },
// uniappinputmaxlength // uniappinputmaxlength
inputMaxlength() { inputMaxlength() {
@ -231,62 +312,71 @@
// style // style
boxStyle() { boxStyle() {
return `color:${this.inputBorder && this.msg?'#e43d33':this.styles.color};` return `color:${
this.inputBorder && this.msg ? "#e43d33" : this.styles.color
};`;
}, },
// input // input
inputContentClass() { inputContentClass() {
return obj2strClass({ return obj2strClass({
'is-input-border': this.inputBorder, "is-input-border": this.inputBorder,
'is-input-error-border': this.inputBorder && this.msg, "is-input-error-border": this.inputBorder && this.msg,
'is-textarea': this.type === 'textarea', "is-textarea": this.type === "textarea",
'is-disabled': this.disabled "is-disabled": this.disabled,
}) });
}, },
inputContentStyle() { inputContentStyle() {
const focusColor = this.focusShow ? '#2979ff' : this.styles.borderColor const focusColor = this.focusShow
const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor ? this.primaryColor
: this.styles.borderColor;
const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
return obj2strStyle({ return obj2strStyle({
'border-color': borderColor || '#e5e5e5', "border-color": borderColor || "#e5e5e5",
'background-color': this.disabled ? this.styles.disableColor : '#fff' "background-color": this.disabled
}) ? this.styles.disableColor
: this.styles.backgroundColor,
});
}, },
// input // input
inputStyle() { inputStyle() {
const paddingRight = this.type === 'password' || this.clearable || this.prefixIcon ? '' : '10px' const paddingRight =
this.type === "password" || this.clearable || this.prefixIcon
? ""
: "10px";
return obj2strStyle({ return obj2strStyle({
'padding-right': paddingRight, "padding-right": paddingRight,
'padding-left': this.prefixIcon ? '' : '10px' "padding-left": this.prefixIcon ? "" : "10px",
}) });
} },
}, },
watch: { watch: {
value(newVal) { value(newVal) {
this.val = newVal this.val = newVal;
}, },
modelValue(newVal) { modelValue(newVal) {
this.val = newVal this.val = newVal;
}, },
focus(newVal) { focus(newVal) {
this.$nextTick(() => { this.$nextTick(() => {
this.focused = this.focus this.focused = this.focus;
this.focusShow = this.focus this.focusShow = this.focus;
}) });
} },
}, },
created() { created() {
this.init() this.init();
// TODO vue3 computed inject formItem.errMsg // TODO vue3 computed inject formItem.errMsg
if (this.form && this.formItem) { if (this.form && this.formItem) {
this.$watch('formItem.errMsg', (newVal) => { this.$watch("formItem.errMsg", (newVal) => {
this.localMsg = newVal this.localMsg = newVal;
}) });
} }
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {
this.focused = this.focus this.focused = this.focus;
this.focusShow = this.focus this.focusShow = this.focus;
}) });
}, },
methods: { methods: {
/** /**
@ -294,11 +384,11 @@
*/ */
init() { init() {
if (this.value || this.value === 0) { if (this.value || this.value === 0) {
this.val = this.value this.val = this.value;
} else if (this.modelValue || this.modelValue === 0) { } else if (this.modelValue || this.modelValue === 0) {
this.val = this.modelValue this.val = this.modelValue;
} else { } else {
this.val = null this.val = null;
} }
}, },
@ -307,15 +397,15 @@
* @param {Object} type * @param {Object} type
*/ */
onClickIcon(type) { onClickIcon(type) {
this.$emit('iconClick', type) this.$emit("iconClick", type);
}, },
/** /**
* 显示隐藏内容密码框时生效 * 显示隐藏内容密码框时生效
*/ */
onEyes() { onEyes() {
this.showPassword = !this.showPassword this.showPassword = !this.showPassword;
this.$emit('eyes', this.showPassword) this.$emit("eyes", this.showPassword);
}, },
/** /**
@ -326,19 +416,19 @@
let value = event.detail.value; let value = event.detail.value;
// //
if (this.trim) { if (this.trim) {
if (typeof(this.trim) === 'boolean' && this.trim) { if (typeof this.trim === "boolean" && this.trim) {
value = this.trimStr(value) value = this.trimStr(value);
} }
if (typeof(this.trim) === 'string') { if (typeof this.trim === "string") {
value = this.trimStr(value, this.trim) value = this.trimStr(value, this.trim);
} }
}; }
if (this.errMsg) this.errMsg = '' if (this.errMsg) this.errMsg = "";
this.val = value this.val = value;
// TODO vue2 // TODO vue2
this.$emit('input', value); this.$emit("input", value);
// TODO  vue3 // TODO  vue3
this.$emit('update:modelValue', value) this.$emit("update:modelValue", value);
}, },
/** /**
@ -348,14 +438,14 @@
*/ */
onFocus() { onFocus() {
this.$nextTick(() => { this.$nextTick(() => {
this.focused = true this.focused = true;
}) });
this.$emit('focus', null); this.$emit("focus", null);
}, },
_Focus(event) { _Focus(event) {
this.focusShow = true this.focusShow = true;
this.$emit('focus', event); this.$emit("focus", event);
}, },
/** /**
@ -364,22 +454,20 @@
* @param {Object} event * @param {Object} event
*/ */
onBlur() { onBlur() {
this.focused = false this.focused = false;
this.$emit('focus', null); this.$emit("focus", null);
}, },
_Blur(event) { _Blur(event) {
let value = event.detail.value; let value = event.detail.value;
this.focusShow = false this.focusShow = false;
this.$emit('blur', event); this.$emit("blur", event);
// eventstring // eventstring
this.$emit('change', this.val) this.$emit("change", this.val);
// //
if (this.form && this.formItem) { if (this.form && this.formItem) {
const { const { validateTrigger } = this.form;
validateTrigger if (validateTrigger === "blur") {
} = this.form this.formItem.onFieldChange();
if (validateTrigger === 'blur') {
this.formItem.onFieldChange()
} }
} }
}, },
@ -389,8 +477,8 @@
* @param {Object} e * @param {Object} e
*/ */
onConfirm(e) { onConfirm(e) {
this.$emit('confirm', this.val); this.$emit("confirm", this.val);
this.$emit('change', this.val) this.$emit("change", this.val);
}, },
/** /**
@ -398,44 +486,44 @@
* @param {Object} event * @param {Object} event
*/ */
onClear(event) { onClear(event) {
this.val = ''; this.val = "";
// TODO vue2 // TODO vue2
this.$emit('input', ''); this.$emit("input", "");
// TODO vue2 // TODO vue2
// TODO  vue3 // TODO  vue3
this.$emit('update:modelValue', '') this.$emit("update:modelValue", "");
// //
this.$emit('clear') this.$emit("clear");
}, },
/** /**
* 去除空格 * 去除空格
*/ */
trimStr(str, pos = 'both') { trimStr(str, pos = "both") {
if (pos === 'both') { if (pos === "both") {
return str.trim(); return str.trim();
} else if (pos === 'left') { } else if (pos === "left") {
return str.trimLeft(); return str.trimLeft();
} else if (pos === 'right') { } else if (pos === "right") {
return str.trimRight(); return str.trimRight();
} else if (pos === 'start') { } else if (pos === "start") {
return str.trimStart() return str.trimStart();
} else if (pos === 'end') { } else if (pos === "end") {
return str.trimEnd() return str.trimEnd();
} else if (pos === 'all') { } else if (pos === "all") {
return str.replace(/\s+/g, ''); return str.replace(/\s+/g, "");
} else if (pos === 'none') { } else if (pos === "none") {
return str; return str;
} }
return str; return str;
} },
} },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
$uni-error: #e43d33; $uni-error: #e43d33;
$uni-border-1: #DCDFE6 !default; $uni-border-1: #dcdfe6 !default;
.uni-easyinput { .uni-easyinput {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@ -556,11 +644,9 @@
.uni-easyinput__placeholder-class { .uni-easyinput__placeholder-class {
color: mix(#fff, $uni-error, 50%); color: mix(#fff, $uni-error, 50%);
;
} }
} }
.uni-easyinput--border { .uni-easyinput--border {
margin-bottom: 0; margin-bottom: 0;
padding: 10px 15px; padding: 10px 15px;
@ -582,11 +668,11 @@
} }
.is-disabled { .is-disabled {
background-color: #F7F6F6; background-color: #f7f6f6;
color: #D5D5D5; color: #d5d5d5;
.uni-easyinput__placeholder-class { .uni-easyinput__placeholder-class {
color: #D5D5D5; color: #d5d5d5;
font-size: 12px; font-size: 12px;
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-easyinput", "id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框", "displayName": "uni-easyinput 增强输入框",
"version": "1.1.0", "version": "1.1.3",
"description": "Easyinput 组件是对原生input组件的增强", "description": "Easyinput 组件是对原生input组件的增强",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [

View File

@ -1,3 +1,7 @@
## 1.2.42022-09-07
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
## 1.2.32022-09-05
- 修复 nvue 环境下,具有 tabBar 时fab 组件下部位置无法正常获取 --window-bottom 的bug详见[https://ask.dcloud.net.cn/question/110638?notification_id=826310](https://ask.dcloud.net.cn/question/110638?notification_id=826310)
## 1.2.22021-12-29 ## 1.2.22021-12-29
- 更新 组件依赖 - 更新 组件依赖
## 1.2.12021-11-19 ## 1.2.12021-11-19

View File

@ -5,7 +5,9 @@
'uni-fab--rightBottom': rightBottom, 'uni-fab--rightBottom': rightBottom,
'uni-fab--leftTop': leftTop, 'uni-fab--leftTop': leftTop,
'uni-fab--rightTop': rightTop 'uni-fab--rightTop': rightTop
}" class="uni-fab"> }" class="uni-fab"
:style="nvueBottom"
>
<view :class="{ <view :class="{
'uni-fab__content--left': horizontal === 'left', 'uni-fab__content--left': horizontal === 'left',
'uni-fab__content--right': horizontal === 'right', 'uni-fab__content--right': horizontal === 'right',
@ -32,7 +34,7 @@
'uni-fab__circle--leftTop': leftTop, 'uni-fab__circle--leftTop': leftTop,
'uni-fab__circle--rightTop': rightTop, 'uni-fab__circle--rightTop': rightTop,
'uni-fab__content--other-platform': !isAndroidNvue 'uni-fab__content--other-platform': !isAndroidNvue
}" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor }" @click="_onClick"> }" class="uni-fab__circle uni-fab__plus" :style="{ 'background-color': styles.buttonColor, 'bottom': nvueBottom }" @click="_onClick">
<uni-icons class="fab-circle-icon" type="plusempty" :color="styles.iconColor" size="32" <uni-icons class="fab-circle-icon" type="plusempty" :color="styles.iconColor" size="32"
:class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons> :class="{'uni-fab__plus--active': isShow && content.length > 0}"></uni-icons>
<!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view> <!-- <view class="fab-circle-v" :class="{'uni-fab__plus--active': isShow && content.length > 0}"></view>
@ -158,6 +160,16 @@
}, },
horizontalRight() { horizontalRight() {
return this.getPosition(2, 'horizontal', 'right') return this.getPosition(2, 'horizontal', 'right')
},
// nvue bottom
nvueBottom() {
const safeBottom = uni.getSystemInfoSync().windowBottom;
// #ifdef APP-NVUE
return 30 + safeBottom
// #endif
// #ifndef APP-NVUE
return 30
// #endif
} }
}, },
watch: { watch: {
@ -194,6 +206,9 @@
* 按钮点击事件 * 按钮点击事件
*/ */
_onItemClick(index, item) { _onItemClick(index, item) {
if (!this.isShow) {
return
}
this.$emit('trigger', { this.$emit('trigger', {
index, index,
item item

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-fab", "id": "uni-fab",
"displayName": "uni-fab 悬浮按钮", "displayName": "uni-fab 悬浮按钮",
"version": "1.2.2", "version": "1.2.4",
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。", "description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss","uni-icons"], "dependencies": ["uni-scss","uni-icons"],

View File

@ -1,3 +1,7 @@
## 1.4.82022-08-23
- 优化 根据 rules 自动添加 required 的问题
## 1.4.72022-08-22
- 修复 item 未设置 require 属性rules 设置 require 后,星号也显示的 bug详见[https://ask.dcloud.net.cn/question/151540](https://ask.dcloud.net.cn/question/151540)
## 1.4.62022-07-13 ## 1.4.62022-07-13
- 修复 model 需要校验的值没有声明对应字段时导致第一次不触发校验的bug - 修复 model 需要校验的值没有声明对应字段时导致第一次不触发校验的bug
## 1.4.52022-07-05 ## 1.4.52022-07-05

View File

@ -387,9 +387,13 @@
// //
_isRequired() { _isRequired() {
if (this.form) { // TODO
return this.required || this.form._isRequiredField(this.itemRules.rules || []) // if (this.form) {
} // if (this.form._isRequiredField(this.itemRules.rules || []) && this.required) {
// return true
// }
// return false
// }
return this.required return this.required
}, },

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-forms", "id": "uni-forms",
"displayName": "uni-forms 表单", "displayName": "uni-forms 表单",
"version": "1.4.6", "version": "1.4.8",
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据", "description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [

View File

@ -1,3 +1,9 @@
## 1.3.92022-10-13
- 修复 条件编译错误的bug
## 1.3.82022-10-12
- 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug
## 1.3.72022-08-11
- 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug
## 1.3.62022-06-30 ## 1.3.62022-06-30
- 修复 组件示例中插槽用法无法显示内容的bug - 修复 组件示例中插槽用法无法显示内容的bug
## 1.3.52022-05-24 ## 1.3.52022-05-24

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="uni-navbar" :class="{'uni-dark':dark}"> <view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
<view :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }" <view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
:style="{ 'background-color': themeBgColor }" class="uni-navbar__content"> :style="{ 'background-color': themeBgColor }" >
<status-bar v-if="statusBar" /> <status-bar v-if="statusBar" />
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}" <view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
class="uni-navbar__header"> class="uni-navbar__header">
@ -38,10 +38,12 @@
</view> </view>
</view> </view>
</view> </view>
<!-- #ifndef APP-NVUE -->
<view class="uni-navbar__placeholder" v-if="fixed"> <view class="uni-navbar__placeholder" v-if="fixed">
<status-bar v-if="statusBar" /> <status-bar v-if="statusBar" />
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" /> <view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
</view> </view>
<!-- #endif -->
</view> </view>
</template> </template>
@ -50,6 +52,8 @@
const getVal = (val) => typeof val === 'number' ? val + 'px' : val; const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
/** /**
*
*
* NavBar 自定义导航栏 * NavBar 自定义导航栏
* @description 导航栏组件主要用于头部导航 * @description 导航栏组件主要用于头部导航
* @tutorial https://ext.dcloud.net.cn/plugin?id=52 * @tutorial https://ext.dcloud.net.cn/plugin?id=52
@ -196,6 +200,11 @@
<style lang="scss" scoped> <style lang="scss" scoped>
$nav-height: 44px; $nav-height: 44px;
.uni-nvue-fixed {
/* #ifdef APP-NVUE */
position: sticky;
/* #endif */
}
.uni-navbar { .uni-navbar {
// box-sizing: border-box; // box-sizing: border-box;
} }

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-nav-bar", "id": "uni-nav-bar",
"displayName": "uni-nav-bar 自定义导航栏", "displayName": "uni-nav-bar 自定义导航栏",
"version": "1.3.6", "version": "1.3.9",
"description": "自定义导航栏组件,主要用于头部导航。", "description": "自定义导航栏组件,主要用于头部导航。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -17,10 +17,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -37,7 +33,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [

View File

@ -1,3 +1,5 @@
## 1.2.12022-09-05
- 新增 属性 fontSize可修改文字大小。
## 1.2.02021-11-19 ## 1.2.02021-11-19
- 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource) - 优化 组件UI并提供设计资源详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-notice-bar](https://uniapp.dcloud.io/component/uniui/uni-notice-bar) - 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-notice-bar](https://uniapp.dcloud.io/component/uniui/uni-notice-bar)

View File

@ -1,24 +1,47 @@
<template> <template>
<view v-if="show" class="uni-noticebar" :style="{ backgroundColor: backgroundColor }" @click="onClick"> <view v-if="show" class="uni-noticebar" :style="{ backgroundColor }" @click="onClick">
<uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound" <uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound"
:color="color" size="22" /> :color="color" :size="fontSize * 1.5" />
<view ref="textBox" class="uni-noticebar__content-wrapper" <view ref="textBox" class="uni-noticebar__content-wrapper"
:class="{'uni-noticebar__content-wrapper--scrollable':scrollable, 'uni-noticebar__content-wrapper--single':!scrollable && (single || moreText)}"> :class="{
'uni-noticebar__content-wrapper--scrollable': scrollable,
'uni-noticebar__content-wrapper--single': !scrollable && (single || moreText)
}"
:style="{ height: scrollable ? fontSize * 1.5 + 'px' : 'auto' }"
>
<view :id="elIdBox" class="uni-noticebar__content" <view :id="elIdBox" class="uni-noticebar__content"
:class="{'uni-noticebar__content--scrollable':scrollable, 'uni-noticebar__content--single':!scrollable && (single || moreText)}"> :class="{
'uni-noticebar__content--scrollable': scrollable,
'uni-noticebar__content--single': !scrollable && (single || moreText)
}"
>
<text :id="elId" ref="animationEle" class="uni-noticebar__content-text" <text :id="elId" ref="animationEle" class="uni-noticebar__content-text"
:class="{'uni-noticebar__content-text--scrollable':scrollable,'uni-noticebar__content-text--single':!scrollable && (single || showGetMore)}" :class="{
:style="{color:color, width:wrapWidth+'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration ,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}">{{text}}</text> 'uni-noticebar__content-text--scrollable': scrollable,
'uni-noticebar__content-text--single': !scrollable && (single || showGetMore)
}"
:style="{
color: color,
fontSize: fontSize + 'px',
lineHeight: fontSize * 1.5 + 'px',
width: wrapWidth + 'px',
'animationDuration': animationDuration,
'-webkit-animationDuration': animationDuration,
animationPlayState: webviewHide ? 'paused' : animationPlayState,
'-webkit-animationPlayState': webviewHide ? 'paused' : animationPlayState,
animationDelay: animationDelay,
'-webkit-animationDelay': animationDelay
}"
>{{text}}</text>
</view> </view>
</view> </view>
<view v-if="showGetMore === true || showGetMore === 'true'" class="uni-noticebar__more uni-cursor-point" <view v-if="isShowGetMore" class="uni-noticebar__more uni-cursor-point"
@click="clickMore"> @click="clickMore">
<text v-if="moreText.length > 0" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}</text> <text v-if="moreText.length > 0" :style="{ color: moreColor, fontSize: fontSize + 'px' }">{{ moreText }}</text>
<uni-icons v-else type="right" :color="moreColor" size="16" /> <uni-icons v-else type="right" :color="moreColor" :size="fontSize * 1.1" />
</view> </view>
<view class="uni-noticebar-close uni-cursor-point" v-if="(showClose === true || showClose === 'true') && (showGetMore === false || showGetMore === 'false')"> <view class="uni-noticebar-close uni-cursor-point" v-if="isShowClose">
<uni-icons <uni-icons type="closeempty" :color="color" :size="fontSize * 1.1" @click="close" />
type="closeempty" :color="color" size="16" @click="close" />
</view> </view>
</view> </view>
</template> </template>
@ -74,6 +97,10 @@
type: String, type: String,
default: '#FF9A43' default: '#FF9A43'
}, },
fontSize: {
type: Number,
default: 14
},
moreColor: { moreColor: {
type: String, type: String,
default: '#FF9A43' default: '#FF9A43'
@ -123,6 +150,15 @@
animationDelay: '0s' animationDelay: '0s'
} }
}, },
computed: {
isShowGetMore() {
return this.showGetMore === true || this.showGetMore === 'true'
},
isShowClose() {
return (this.showClose === true || this.showClose === 'true')
&& (this.showGetMore === false || this.showGetMore === 'false')
}
},
mounted() { mounted() {
// #ifdef APP-PLUS // #ifdef APP-PLUS
var pages = getCurrentPages(); var pages = getCurrentPages();
@ -262,7 +298,7 @@
} }
</script> </script>
<style lang="scss" > <style lang="scss" scoped>
.uni-noticebar { .uni-noticebar {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -310,7 +346,6 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
.uni-noticebar__content-wrapper--scrollable { .uni-noticebar__content-wrapper--scrollable {
position: relative; position: relative;
height: 18px;
} }
/* #endif */ /* #endif */
@ -383,10 +418,6 @@
padding-left: 5px; padding-left: 5px;
} }
.uni-noticebar__more-text {
font-size: 14px;
}
@keyframes notice { @keyframes notice {
100% { 100% {
transform: translate3d(-100%, 0, 0); transform: translate3d(-100%, 0, 0);

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-notice-bar", "id": "uni-notice-bar",
"displayName": "uni-notice-bar 通告栏", "displayName": "uni-notice-bar 通告栏",
"version": "1.2.0", "version": "1.2.1",
"description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告", "description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -18,10 +18,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -38,7 +34,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [ "dependencies": [

View File

@ -1,3 +1,10 @@
## 1.2.42022-09-19
- 修复,未对主题色设置默认色,导致未引入 uni-scss 变量文件报错。
- 修复,未对移动端当前页文字做主题色适配。
## 1.2.32022-09-15
- 修复未使用 uni-scss 主题色的 bug。
## 1.2.22022-07-06
- 修复 es 语言 i18n 错误
## 1.2.12021-11-22 ## 1.2.12021-11-22
- 修复 vue3中某些scss变量无法找到的问题 - 修复 vue3中某些scss变量无法找到的问题
## 1.2.02021-11-19 ## 1.2.02021-11-19

View File

@ -1,4 +1,5 @@
{ {
"uni-pagination.prevText": "prev", "uni-pagination.prevText": "prev",
"uni-pagination.nextText": "next" "uni-pagination.nextText": "next",
"uni-pagination.piecePerPage": "piece/page"
} }

View File

@ -1,4 +1,5 @@
{ {
"uni-pagination.prevText": "anterior", "uni-pagination.prevText": "anterior",
"uni-pagination.nextText": "próxima" "uni-pagination.nextText": "prxima",
"uni-pagination.piecePerPage": "Art¨ªculo/P¨¢gina"
} }

View File

@ -1,4 +1,5 @@
{ {
"uni-pagination.prevText": "précédente", "uni-pagination.prevText": "précédente",
"uni-pagination.nextText": "suivante" "uni-pagination.nextText": "suivante",
"uni-pagination.piecePerPage": "Articles/Pages"
} }

View File

@ -1,4 +1,5 @@
{ {
"uni-pagination.prevText": "上一页", "uni-pagination.prevText": "上一页",
"uni-pagination.nextText": "下一页" "uni-pagination.nextText": "下一页",
"uni-pagination.piecePerPage": "条/页"
} }

View File

@ -1,4 +1,5 @@
{ {
"uni-pagination.prevText": "上一頁", "uni-pagination.prevText": "上一頁",
"uni-pagination.nextText": "下一頁" "uni-pagination.nextText": "下一頁",
"uni-pagination.piecePerPage": "條/頁"
} }

View File

@ -1,5 +1,15 @@
<template> <template>
<view class="uni-pagination"> <view class="uni-pagination">
<!-- #ifndef MP -->
<picker v-if="showPageSize === true || showPageSize === 'true'" class="select-picker" mode="selector"
:value="pageSizeIndex" :range="pageSizeRange" @change="pickerChange" @cancel="pickerClick"
@click.native="pickerClick">
<button type="default" size="mini" :plain="true">
<text>{{pageSizeRange[pageSizeIndex]}} {{piecePerPage}}</text>
<uni-icons class="select-picker-icon" type="arrowdown" size="12" color="#999"></uni-icons>
</button>
</picker>
<!-- #endif -->
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view class="uni-pagination__total is-phone-hide"> {{ total }} </view> <view class="uni-pagination__total is-phone-hide"> {{ total }} </view>
<!-- #endif --> <!-- #endif -->
@ -16,8 +26,7 @@
</view> </view>
<view class="uni-pagination__num uni-pagination__num-flex-none"> <view class="uni-pagination__num uni-pagination__num-flex-none">
<view class="uni-pagination__num-current"> <view class="uni-pagination__num-current">
<text class="uni-pagination__num-current-text is-pc-hide" <text class="uni-pagination__num-current-text is-pc-hide current-index-text">{{ currentIndex }}</text>
style="color:#409EFF">{{ currentIndex }}</text>
<text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text> <text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text>
<!-- #ifndef APP-NVUE --> <!-- #ifndef APP-NVUE -->
<view v-for="(item, index) in paper" :key="index" :class="{ 'page--active': item === currentIndex }" <view v-for="(item, index) in paper" :key="index" :class="{ 'page--active': item === currentIndex }"
@ -49,11 +58,15 @@
* @tutorial https://ext.dcloud.net.cn/plugin?id=32 * @tutorial https://ext.dcloud.net.cn/plugin?id=32
* @property {String} prevText 左侧按钮文字 * @property {String} prevText 左侧按钮文字
* @property {String} nextText 右侧按钮文字 * @property {String} nextText 右侧按钮文字
* @property {String} piecePerPageText /页文字
* @property {Number} current 当前页 * @property {Number} current 当前页
* @property {Number} total 数据总量 * @property {Number} total 数据总量
* @property {Number} pageSize 每页数据量 * @property {Number} pageSize 每页数据量
* @property {Number} showIcon = [true|false] 是否以 icon 形式展示按钮 * @property {Boolean} showIcon = [true|false] 是否以 icon 形式展示按钮
* @property {Boolean} showPageSize = [true|false] 是否展示每页条数
* @property {Array} pageSizeRange = [20, 50, 100, 500] 每页条数选框
* @event {Function} change 点击页码按钮时触发 ,e={type,current} current为当前页type值为next/prev表示点击的是上一页还是下一个 * @event {Function} change 点击页码按钮时触发 ,e={type,current} current为当前页type值为next/prev表示点击的是上一页还是下一个
* * @event {Function} pageSizeChange 当前每页条数改变时触发 ,e={pageSize} pageSize 为当前所选的每页条数
*/ */
import { import {
@ -65,7 +78,7 @@
} = initVueI18n(messages) } = initVueI18n(messages)
export default { export default {
name: 'UniPagination', name: 'UniPagination',
emits: ['update:modelValue', 'input', 'change'], emits: ['update:modelValue', 'input', 'change', 'pageSizeChange'],
props: { props: {
value: { value: {
type: [Number, String], type: [Number, String],
@ -81,6 +94,9 @@
nextText: { nextText: {
type: String, type: String,
}, },
piecePerPageText: {
type: String
},
current: { current: {
type: [Number, String], type: [Number, String],
default: 1 default: 1
@ -100,18 +116,32 @@
type: [Boolean, String], type: [Boolean, String],
default: false default: false
}, },
showPageSize: {
// icon
type: [Boolean, String],
default: false
},
pagerCount: { pagerCount: {
type: Number, type: Number,
default: 7 default: 7
},
pageSizeRange: {
type: Array,
default: () => [20, 50, 100, 500]
} }
}, },
data() { data() {
return { return {
pageSizeIndex: 0,
currentIndex: 1, currentIndex: 1,
paperData: [] paperData: [],
pickerShow: false
} }
}, },
computed: { computed: {
piecePerPage() {
return this.piecePerPageText || t('uni-pagination.piecePerPage')
},
prevPageText() { prevPageText() {
return this.prevText || t('uni-pagination.prevText') return this.prevText || t('uni-pagination.prevText')
}, },
@ -199,9 +229,31 @@
this.currentIndex = val this.currentIndex = val
} }
} }
},
pageSizeIndex(val) {
this.$emit('pageSizeChange', this.pageSizeRange[val])
} }
}, },
methods: { methods: {
pickerChange(e) {
this.pageSizeIndex = e.detail.value
this.pickerClick()
},
pickerClick() {
// #ifdef H5
const body = document.querySelector('body')
if (!body) return
const className = 'uni-pagination-picker-show'
this.pickerShow = !this.pickerShow
if (this.pickerShow) {
body.classList.add(className)
} else {
setTimeout(() => body.classList.remove(className), 300)
}
// #endif
},
// //
selectPage(e, index) { selectPage(e, index) {
if (parseInt(e)) { if (parseInt(e)) {
@ -256,8 +308,8 @@
} }
</script> </script>
<style lang="scss" > <style lang="scss" scoped>
$uni-primary: #2979ff; $uni-primary: #2979ff !default;
.uni-pagination { .uni-pagination {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
@ -352,6 +404,10 @@
font-size: 15px; font-size: 15px;
} }
.current-index-text{
color: $uni-primary;
}
.uni-pagination--enabled { .uni-pagination--enabled {
color: #333333; color: #333333;
opacity: 1; opacity: 1;

View File

@ -1,7 +1,7 @@
{ {
"id": "uni-pagination", "id": "uni-pagination",
"displayName": "uni-pagination 分页器", "displayName": "uni-pagination 分页器",
"version": "1.2.1", "version": "1.2.4",
"description": "Pagination 分页器组件,用于展示页码、请求数据等。", "description": "Pagination 分页器组件,用于展示页码、请求数据等。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
@ -17,10 +17,6 @@
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
@ -37,7 +33,8 @@
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
}, },
"uni_modules": { "uni_modules": {
"dependencies": ["uni-scss","uni-icons"], "dependencies": ["uni-scss","uni-icons"],

View File

@ -9,5 +9,3 @@
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-pagination) ### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-pagination)
#### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839 #### 如使用过程中有任何问题或者您对uni-ui有一些好的建议欢迎加入 uni-ui 交流群871950839

View File

@ -1,10 +1,10 @@
<template> <template>
<view v-if="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']"> <view v-if="showPopup||onceRender" v-show="showPopup" class="uni-popup" :class="[popupstyle, isDesktop ? 'fixforpc-z-index' : '']">
<view @touchstart="touchstart"> <view @touchstart="touchstart">
<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass" <uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass"
:duration="duration" :show="showTrans" @click="onTap" /> :duration="duration" :show="showTrans" @click="onTap" />
<uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration" <uni-transition key="2" :mode-class="ani" name="content" :styles="transClass" :duration="duration"
:show="showTrans" @click="onTap"> :show="showTrans" @click="onTap" :once-render="onceRender">
<view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear"> <view class="uni-popup__wrapper" :style="{ backgroundColor: bg }" :class="[popupstyle]" @click="clear">
<slot /> <slot />
</view> </view>
@ -86,6 +86,11 @@
type: String, type: String,
default: 'rgba(0, 0, 0, 0.4)' default: 'rgba(0, 0, 0, 0.4)'
}, },
// 使v-showPop
onceRender:{
type:Boolean,
default:false
},
}, },
watch: { watch: {

View File

@ -125,7 +125,7 @@ export default {
} else { } else {
startIndex = theadChildren.rowspan - 1 startIndex = theadChildren.rowspan - 1
} }
let isHaveData = this.data && this.data.length.length > 0 let isHaveData = this.data && this.data.length > 0
theadChildren.checked = true theadChildren.checked = true
theadChildren.indeterminate = false theadChildren.indeterminate = false
this.trChildren.forEach((item, index) => { this.trChildren.forEach((item, index) => {

View File

@ -1,5 +1,5 @@
<template> <template>
<view v-if="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view> <view v-if="isShow||onceRender" v-show="isShow" ref="ani" :animation="animationData" :class="customClass" :style="transformStyles" @click="onClick"><slot></slot></view>
</template> </template>
<script> <script>
@ -48,7 +48,11 @@ export default {
customClass:{ customClass:{
type: String, type: String,
default: '' default: ''
} },
onceRender:{
type:Boolean,
default:false
},
}, },
data() { data() {
return { return {