升级uni-ui到最新版本1.4.23
This commit is contained in:
parent
9bca5bebd5
commit
55fb5c5f61
@ -1,6 +1,7 @@
|
||||
// 应用全局配置
|
||||
module.exports = {
|
||||
baseUrl: 'http://localhost:8080',
|
||||
baseUrl: 'https://vue.ruoyi.vip/prod-api',
|
||||
// baseUrl: 'http://localhost:8080',
|
||||
// 应用信息
|
||||
appInfo: {
|
||||
// 应用名称
|
||||
|
@ -1,3 +1,5 @@
|
||||
## 1.2.1(2022-09-05)
|
||||
- 修复 当 text 超过 max-num 时,badge 的宽度计算是根据 text 的长度计算,更改为 css 计算实际展示宽度,详见:[https://ask.dcloud.net.cn/question/150473](https://ask.dcloud.net.cn/question/150473)
|
||||
## 1.2.0(2021-11-19)
|
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-badge](https://uniapp.dcloud.io/component/uniui/uni-badge)
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="uni-badge--x">
|
||||
<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>
|
||||
</view>
|
||||
</template>
|
||||
@ -130,16 +130,13 @@
|
||||
const match = whiteList[this.absolute]
|
||||
return match ? match : whiteList['rightTop']
|
||||
},
|
||||
badgeWidth() {
|
||||
return {
|
||||
width: `${this.width}px`
|
||||
}
|
||||
},
|
||||
dotStyle() {
|
||||
if (!this.isDot) return {}
|
||||
return {
|
||||
width: '10px',
|
||||
minWidth: '0',
|
||||
height: '10px',
|
||||
padding: '0',
|
||||
borderRadius: '10px'
|
||||
}
|
||||
},
|
||||
@ -199,6 +196,8 @@
|
||||
justify-content: center;
|
||||
flex-direction: row;
|
||||
height: 20px;
|
||||
min-width: 20px;
|
||||
padding: 0 4px;
|
||||
line-height: 18px;
|
||||
color: #fff;
|
||||
border-radius: 100px;
|
||||
@ -207,6 +206,7 @@
|
||||
border: 1px solid #fff;
|
||||
text-align: center;
|
||||
font-family: 'Helvetica Neue', Helvetica, sans-serif;
|
||||
font-feature-settings: "tnum";
|
||||
font-size: $bage-size;
|
||||
/* #ifdef H5 */
|
||||
z-index: 999;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-badge",
|
||||
"displayName": "uni-badge 数字角标",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
|
||||
"keywords": [
|
||||
"",
|
||||
@ -18,11 +18,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -39,7 +35,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-scss"],
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 1.4.7(2022-09-16)
|
||||
- 可以使用 uni-scss 控制主题色
|
||||
## 1.4.6(2022-09-08)
|
||||
- fix: 表头年月切换,导致改变当前日期为选择月1号,且未触发change事件
|
||||
## 1.4.5(2022-02-25)
|
||||
- 修复 条件编译 nvue 不支持的 css 样式
|
||||
## 1.4.4(2022-02-25)
|
||||
|
@ -102,7 +102,7 @@
|
||||
$uni-color-error: #e43d33;
|
||||
$uni-opacity-disabled: 0.3;
|
||||
$uni-text-color-disable:#c0c0c0;
|
||||
$uni-color-primary: #2979ff;
|
||||
$uni-primary: #2979ff !default;
|
||||
.uni-calendar-item__weeks-box {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
@ -152,11 +152,11 @@
|
||||
}
|
||||
|
||||
.uni-calendar-item--isDay-text {
|
||||
color: $uni-color-primary;
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.uni-calendar-item--isDay {
|
||||
background-color: $uni-color-primary;
|
||||
background-color: $uni-primary;
|
||||
opacity: 0.8;
|
||||
color: #fff;
|
||||
}
|
||||
@ -167,13 +167,13 @@
|
||||
}
|
||||
|
||||
.uni-calendar-item--checked {
|
||||
background-color: $uni-color-primary;
|
||||
background-color: $uni-primary;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.uni-calendar-item--multiple {
|
||||
background-color: $uni-color-primary;
|
||||
background-color: $uni-primary;
|
||||
color: #fff;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
@ -218,7 +218,7 @@
|
||||
bindDateChange(e) {
|
||||
const value = e.detail.value + '-1'
|
||||
console.log(this.cale.getDate(value));
|
||||
this.init(value)
|
||||
this.setDate(value)
|
||||
},
|
||||
/**
|
||||
* 初始化日期显示
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-calendar",
|
||||
"displayName": "uni-calendar 日历",
|
||||
"version": "1.4.5",
|
||||
"version": "1.4.7",
|
||||
"description": "日历组件",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -18,11 +18,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -39,7 +35,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [],
|
||||
|
@ -1,3 +1,5 @@
|
||||
## 1.0.3(2022-09-16)
|
||||
- 可以使用 uni-scss 控制主题色
|
||||
## 1.0.2(2022-06-30)
|
||||
- 优化 在 uni-forms 中的依赖注入方式
|
||||
## 1.0.1(2022-02-07)
|
||||
|
@ -384,12 +384,14 @@
|
||||
setStyleBackgroud(item) {
|
||||
let styles = {}
|
||||
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
||||
if (this.selectedColor) {
|
||||
if (this.mode !== 'list') {
|
||||
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
||||
}
|
||||
if (this.mode === 'tag') {
|
||||
styles['background-color'] = item.selected? selectedColor:'#f5f5f5'
|
||||
}
|
||||
}
|
||||
let classles = ''
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`
|
||||
@ -399,6 +401,7 @@
|
||||
setStyleIcon(item) {
|
||||
let styles = {}
|
||||
let classles = ''
|
||||
if (this.selectedColor) {
|
||||
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
||||
styles['background-color'] = item.selected?selectedColor:'#fff'
|
||||
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
||||
@ -407,7 +410,7 @@
|
||||
styles['background-color'] = '#F2F6FC'
|
||||
styles['border-color'] = item.selected?selectedColor:'#DCDFE6'
|
||||
}
|
||||
|
||||
}
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`
|
||||
}
|
||||
@ -416,6 +419,7 @@
|
||||
setStyleIconText(item) {
|
||||
let styles = {}
|
||||
let classles = ''
|
||||
if (this.selectedColor) {
|
||||
let selectedColor = this.selectedColor?this.selectedColor:'#2979ff'
|
||||
if (this.mode === 'tag') {
|
||||
styles.color = item.selected?(this.selectedTextColor?this.selectedTextColor:'#fff'):'#666'
|
||||
@ -425,7 +429,7 @@
|
||||
if(!item.selected && item.disabled){
|
||||
styles.color = '#999'
|
||||
}
|
||||
|
||||
}
|
||||
for (let i in styles) {
|
||||
classles += `${i}:${styles[i]};`
|
||||
}
|
||||
@ -448,7 +452,7 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
$checked-color: #2979ff;
|
||||
$uni-primary: #2979ff !default;
|
||||
$border-color: #DCDFE6;
|
||||
$disable:0.4;
|
||||
|
||||
@ -614,8 +618,8 @@
|
||||
// 选中
|
||||
&.is-checked {
|
||||
.checkbox__inner {
|
||||
border-color: $checked-color;
|
||||
background-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
background-color: $uni-primary;
|
||||
|
||||
.checkbox__inner-icon {
|
||||
opacity: 1;
|
||||
@ -623,14 +627,14 @@
|
||||
}
|
||||
}
|
||||
.radio__inner {
|
||||
border-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
.radio__inner-icon {
|
||||
opacity: 1;
|
||||
background-color: $checked-color;
|
||||
background-color: $uni-primary;
|
||||
}
|
||||
}
|
||||
.checklist-text {
|
||||
color: $checked-color;
|
||||
color: $uni-primary;
|
||||
}
|
||||
// 选中禁用
|
||||
&.is-disable {
|
||||
@ -683,10 +687,10 @@
|
||||
}
|
||||
|
||||
&.is-checked {
|
||||
border-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
.checkbox__inner {
|
||||
border-color: $checked-color;
|
||||
background-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
background-color: $uni-primary;
|
||||
.checkbox__inner-icon {
|
||||
opacity: 1;
|
||||
transform: rotate(45deg);
|
||||
@ -694,16 +698,16 @@
|
||||
}
|
||||
|
||||
.radio__inner {
|
||||
border-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
|
||||
.radio__inner-icon {
|
||||
opacity: 1;
|
||||
background-color: $checked-color;
|
||||
background-color: $uni-primary;
|
||||
}
|
||||
}
|
||||
|
||||
.checklist-text {
|
||||
color: $checked-color;
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
// 选中禁用
|
||||
@ -735,8 +739,8 @@
|
||||
}
|
||||
|
||||
&.is-checked {
|
||||
background-color: $checked-color;
|
||||
border-color: $checked-color;
|
||||
background-color: $uni-primary;
|
||||
border-color: $uni-primary;
|
||||
|
||||
.checklist-text {
|
||||
color: #fff;
|
||||
@ -775,8 +779,8 @@
|
||||
|
||||
&.is-checked {
|
||||
.checkbox__inner {
|
||||
border-color: $checked-color;
|
||||
background-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
background-color: $uni-primary;
|
||||
|
||||
.checkbox__inner-icon {
|
||||
opacity: 1;
|
||||
@ -789,13 +793,13 @@
|
||||
}
|
||||
}
|
||||
.checklist-text {
|
||||
color: $checked-color;
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.checklist-content {
|
||||
.checkobx__list {
|
||||
opacity: 1;
|
||||
border-color: $checked-color;
|
||||
border-color: $uni-primary;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-data-checkbox",
|
||||
"displayName": "uni-data-checkbox 数据选择器",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "通过数据驱动的单选框和复选框",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-load-more","uni-scss"],
|
||||
|
@ -1,3 +1,5 @@
|
||||
## 1.0.8(2022-09-16)
|
||||
- 可以使用 uni-scss 控制主题色
|
||||
## 1.0.7(2022-07-06)
|
||||
- 优化 pc端图标位置不正确的问题
|
||||
## 1.0.6(2022-07-05)
|
||||
|
@ -16,8 +16,7 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
<text v-else class="selected-area placeholder">{{placeholder}}</text>
|
||||
<view v-if="clearIcon && !readonly && inputSelected.length" class="icon-clear"
|
||||
@click.stop="clear">
|
||||
<view v-if="clearIcon && !readonly && inputSelected.length" class="icon-clear" @click.stop="clear">
|
||||
<uni-icons type="clear" color="#c0c4cc" size="24"></uni-icons>
|
||||
</view>
|
||||
<view class="arrow-area" v-if="(!clearIcon || !inputSelected.length) && !readonly ">
|
||||
@ -40,8 +39,8 @@
|
||||
</view>
|
||||
<data-picker-view class="picker-view" ref="pickerView" v-model="dataValue" :localdata="localdata"
|
||||
:preload="preload" :collection="collection" :field="field" :orderby="orderby" :where="where"
|
||||
:step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true"
|
||||
:map="map" :ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick">
|
||||
:step-searh="stepSearh" :self-field="selfField" :parent-field="parentField" :managed-mode="true" :map="map"
|
||||
:ellipsis="ellipsis" @change="onchange" @datachange="ondatachange" @nodeclick="onnodeclick">
|
||||
</data-picker-view>
|
||||
</view>
|
||||
</view>
|
||||
@ -128,58 +127,46 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.form = this.getForm('uniForms')
|
||||
this.formItem = this.getForm('uniFormsItem')
|
||||
if (this.formItem) {
|
||||
if (this.formItem.name) {
|
||||
this.rename = this.formItem.name
|
||||
this.form.inputChildrens.push(this)
|
||||
}
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.load()
|
||||
this.load();
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
clear() {
|
||||
this.inputSelected.splice(0)
|
||||
this._dispatchEvent([])
|
||||
this.modelValue = null;
|
||||
this._dispatchEvent([]);
|
||||
},
|
||||
onPropsChange() {
|
||||
this._treeData = []
|
||||
this.selectedIndex = 0
|
||||
this.load()
|
||||
this._treeData = [];
|
||||
this.selectedIndex = 0;
|
||||
|
||||
this.load();
|
||||
},
|
||||
load() {
|
||||
if (this.readonly) {
|
||||
this._processReadonly(this.localdata, this.dataValue)
|
||||
return
|
||||
this._processReadonly(this.localdata, this.dataValue);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.isLocaldata) {
|
||||
this.loadData()
|
||||
this.inputSelected = this.selected.slice(0)
|
||||
} else if (!this.parentField && !this.selfField && this.hasValue) {
|
||||
this.getNodeData(() => {
|
||||
this.inputSelected = this.selected.slice(0)
|
||||
})
|
||||
} else if (this.hasValue) {
|
||||
this.getTreePath(() => {
|
||||
this.inputSelected = this.selected.slice(0)
|
||||
if (!this.hasValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 回显本地数据
|
||||
if (this.isLocalData) {
|
||||
this.loadData();
|
||||
this.inputSelected = this.selected.slice(0);
|
||||
} else if (this.isCloudDataList || this.isCloudDataTree) { // 回显 Cloud 数据
|
||||
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() {
|
||||
this.isOpened = true
|
||||
setTimeout(() => {
|
||||
@ -294,7 +281,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style >
|
||||
<style>
|
||||
.uni-data-tree {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
@ -413,7 +400,12 @@
|
||||
.uni-data-tree-dialog {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
/* #ifndef APP-NVUE */
|
||||
top: 20%;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
top: 200px;
|
||||
/* #endif */
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #FFFFFF;
|
||||
@ -550,5 +542,6 @@
|
||||
border-top-width: 0;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
</style>
|
||||
</style>
|
||||
|
@ -42,7 +42,7 @@ export default {
|
||||
},
|
||||
pageSize: {
|
||||
type: Number,
|
||||
default: 20
|
||||
default: 500
|
||||
},
|
||||
getcount: {
|
||||
type: [Boolean, String],
|
||||
@ -94,7 +94,7 @@ export default {
|
||||
},
|
||||
map: {
|
||||
type: Object,
|
||||
default() {
|
||||
default () {
|
||||
return {
|
||||
text: "text",
|
||||
value: "value"
|
||||
@ -122,19 +122,22 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isLocaldata() {
|
||||
return !this.collection.length
|
||||
isLocalData() {
|
||||
return !this.collection.length;
|
||||
},
|
||||
postField() {
|
||||
let fields = [this.field];
|
||||
if (this.parentField) {
|
||||
fields.push(`${this.parentField} as parent_value`);
|
||||
}
|
||||
return fields.join(',');
|
||||
isCloudData() {
|
||||
return this.collection.length > 0;
|
||||
},
|
||||
isCloudDataList() {
|
||||
return (this.isCloudData && (!this.parentField && !this.selfField));
|
||||
},
|
||||
isCloudDataTree() {
|
||||
return (this.isCloudData && this.parentField && this.selfField);
|
||||
},
|
||||
dataValue() {
|
||||
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null || this.modelValue !== undefined)
|
||||
return isModelValue ? this.modelValue : this.value
|
||||
let isModelValue = Array.isArray(this.modelValue) ? (this.modelValue.length > 0) : (this.modelValue !== null ||
|
||||
this.modelValue !== undefined);
|
||||
return isModelValue ? this.modelValue : this.value;
|
||||
},
|
||||
hasValue() {
|
||||
if (typeof this.dataValue === 'number') {
|
||||
@ -183,8 +186,169 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
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 = {}) {
|
||||
/* eslint-disable no-undef */
|
||||
let db = uniCloud.database(this.spaceInfo)
|
||||
@ -229,125 +393,16 @@ export default {
|
||||
|
||||
return db
|
||||
},
|
||||
getNodeData(callback) {
|
||||
if (this.loading) {
|
||||
return
|
||||
|
||||
_cloudDataPostField() {
|
||||
let fields = [this.field];
|
||||
if (this.parentField) {
|
||||
fields.push(`${this.parentField} as parent_value`);
|
||||
}
|
||||
this.loading = true
|
||||
this.getCommand({
|
||||
field: this.postField,
|
||||
where: this._pathWhere()
|
||||
}).then((res) => {
|
||||
this.loading = false
|
||||
this.selected = res.result.data
|
||||
callback && callback()
|
||||
}).catch((err) => {
|
||||
this.loading = false
|
||||
this.errorMessage = err
|
||||
})
|
||||
return fields.join(',');
|
||||
},
|
||||
getTreePath(callback) {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
this.loading = true
|
||||
|
||||
this.getCommand({
|
||||
field: this.postField,
|
||||
getTreePath: {
|
||||
startWith: `${this.selfField}=='${this.dataValue}'`
|
||||
}
|
||||
}).then((res) => {
|
||||
this.loading = false
|
||||
let treePath = []
|
||||
this._extractTreePath(res.result.data, treePath)
|
||||
this.selected = treePath
|
||||
callback && callback()
|
||||
}).catch((err) => {
|
||||
this.loading = false
|
||||
this.errorMessage = err
|
||||
})
|
||||
},
|
||||
loadData() {
|
||||
if (this.isLocaldata) {
|
||||
this._processLocalData()
|
||||
return
|
||||
}
|
||||
|
||||
if (this.dataValue != null) {
|
||||
this._loadNodeData((data) => {
|
||||
this._treeData = data
|
||||
this._updateBindData()
|
||||
this._updateSelected()
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if (this.stepSearh) {
|
||||
this._loadNodeData((data) => {
|
||||
this._treeData = data
|
||||
this._updateBindData()
|
||||
})
|
||||
} else {
|
||||
this._loadAllData((data) => {
|
||||
this._treeData = []
|
||||
this._extractTree(data, this._treeData, null)
|
||||
this._updateBindData()
|
||||
})
|
||||
}
|
||||
},
|
||||
_loadAllData(callback) {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
this.loading = true
|
||||
|
||||
this.getCommand({
|
||||
field: this.postField,
|
||||
gettree: true,
|
||||
startwith: `${this.selfField}=='${this.dataValue}'`
|
||||
}).then((res) => {
|
||||
this.loading = false
|
||||
callback(res.result.data)
|
||||
this.onDataChange()
|
||||
}).catch((err) => {
|
||||
this.loading = false
|
||||
this.errorMessage = err
|
||||
})
|
||||
},
|
||||
_loadNodeData(callback, pw) {
|
||||
if (this.loading) {
|
||||
return
|
||||
}
|
||||
this.loading = true
|
||||
|
||||
this.getCommand({
|
||||
field: this.postField,
|
||||
where: pw || this._postWhere(),
|
||||
pageSize: 500
|
||||
}).then((res) => {
|
||||
this.loading = false
|
||||
callback(res.result.data)
|
||||
this.onDataChange()
|
||||
}).catch((err) => {
|
||||
this.loading = false
|
||||
this.errorMessage = err
|
||||
})
|
||||
},
|
||||
_pathWhere() {
|
||||
let result = []
|
||||
let where_field = this._getParentNameByField();
|
||||
if (where_field) {
|
||||
result.push(`${where_field} == '${this.dataValue}'`)
|
||||
}
|
||||
|
||||
if (this.where) {
|
||||
return `(${this.where}) && (${result.join(' || ')})`
|
||||
}
|
||||
|
||||
return result.join(' || ')
|
||||
},
|
||||
_postWhere() {
|
||||
_cloudDataTreeWhere() {
|
||||
let result = []
|
||||
let selected = this.selected
|
||||
let parentField = this.parentField
|
||||
@ -364,17 +419,35 @@ export default {
|
||||
if (this.where) {
|
||||
where.push(`(${this.where})`)
|
||||
}
|
||||
|
||||
if (result.length) {
|
||||
where.push(`(${result.join(' || ')})`)
|
||||
}
|
||||
|
||||
return where.join(' && ')
|
||||
},
|
||||
_nodeWhere() {
|
||||
let result = []
|
||||
let selected = this.selected
|
||||
|
||||
_cloudDataNodeWhere() {
|
||||
let where = []
|
||||
let selected = this.selected;
|
||||
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) {
|
||||
@ -383,41 +456,23 @@ export default {
|
||||
|
||||
return result.join(' || ')
|
||||
},
|
||||
_getParentNameByField() {
|
||||
const fields = this.field.split(',');
|
||||
let where_field = null;
|
||||
|
||||
_getForeignKeyByField() {
|
||||
let fields = this.field.split(',');
|
||||
let whereField = null;
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
const items = fields[i].split('as');
|
||||
if (items.length < 2) {
|
||||
continue;
|
||||
}
|
||||
if (items[1].trim() === 'value') {
|
||||
where_field = items[0].trim();
|
||||
whereField = items[0].trim();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return where_field
|
||||
},
|
||||
_isTreeView() {
|
||||
return (this.parentField && this.selfField)
|
||||
},
|
||||
_updateSelected() {
|
||||
var dl = this.dataList
|
||||
var sl = this.selected
|
||||
let textField = this.map.text
|
||||
let valueField = this.map.value
|
||||
for (var i = 0; i < sl.length; i++) {
|
||||
var value = sl[i].value
|
||||
var dl2 = dl[i]
|
||||
for (var j = 0; j < dl2.length; j++) {
|
||||
var item2 = dl2[j]
|
||||
if (item2[valueField] === value) {
|
||||
sl[i].text = item2[textField]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
return whereField;
|
||||
},
|
||||
|
||||
_updateBindData(node) {
|
||||
const {
|
||||
dataList,
|
||||
@ -445,6 +500,25 @@ export default {
|
||||
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) {
|
||||
let dataList = []
|
||||
let hasNodes = true
|
||||
@ -453,8 +527,8 @@ export default {
|
||||
return (item.parent_value === null || item.parent_value === undefined || item.parent_value === '')
|
||||
}))
|
||||
for (let i = 0; i < paths.length; i++) {
|
||||
var value = paths[i].value
|
||||
var nodes = data.filter((item) => {
|
||||
let value = paths[i].value
|
||||
let nodes = data.filter((item) => {
|
||||
return item.parent_value === value
|
||||
})
|
||||
|
||||
@ -470,6 +544,7 @@ export default {
|
||||
hasNodes
|
||||
}
|
||||
},
|
||||
|
||||
_extractTree(nodes, result, parent_value) {
|
||||
let list = result || []
|
||||
let valueField = this.map.value
|
||||
@ -493,6 +568,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_extractTreePath(nodes, result) {
|
||||
let list = result || []
|
||||
for (let i = 0; i < nodes.length; i++) {
|
||||
@ -512,6 +588,7 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_findNodePath(key, nodes, path = []) {
|
||||
let textField = this.map.text
|
||||
let valueField = this.map.value
|
||||
@ -540,24 +617,6 @@ export default {
|
||||
path.pop()
|
||||
}
|
||||
return []
|
||||
},
|
||||
_processLocalData() {
|
||||
this._treeData = []
|
||||
this._extractTree(this.localdata, this._treeData)
|
||||
|
||||
var inputValue = this.dataValue
|
||||
if (inputValue === undefined) {
|
||||
return
|
||||
}
|
||||
|
||||
if (Array.isArray(inputValue)) {
|
||||
inputValue = inputValue[inputValue.length - 1]
|
||||
if (typeof inputValue === 'object' && inputValue[this.map.value]) {
|
||||
inputValue = inputValue[this.map.value]
|
||||
}
|
||||
}
|
||||
|
||||
this.selected = this._findNodePath(inputValue, this.localdata)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,22 +1,22 @@
|
||||
<template>
|
||||
<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">
|
||||
<template v-for="(item,index) in selected">
|
||||
<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)">
|
||||
<text class="">{{item.text}}</text>
|
||||
<text>{{item.text}}</text>
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="tab-c">
|
||||
<template v-for="(child, i) in dataList" >
|
||||
<template v-for="(child, i) in dataList">
|
||||
<scroll-view class="list" :key="i" v-if="i==selectedIndex" :scroll-y="true">
|
||||
<view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in child"
|
||||
@click="handleNodeClick(item, i, j)">
|
||||
<text class="item-text item-text-overflow">{{item[map.text]}}</text>
|
||||
<text class="item-text">{{item[map.text]}}</text>
|
||||
<view class="check" v-if="selected.length > i && item[map.value] == selected[i].value"></view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@ -64,43 +64,33 @@
|
||||
default: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
},
|
||||
created() {
|
||||
if (this.managedMode) {
|
||||
return
|
||||
}
|
||||
|
||||
if (!this.managedMode) {
|
||||
this.$nextTick(() => {
|
||||
this.load()
|
||||
this.loadData();
|
||||
})
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onPropsChange() {
|
||||
this._treeData = []
|
||||
this.selectedIndex = 0
|
||||
this.load()
|
||||
},
|
||||
load() {
|
||||
if (this.isLocaldata) {
|
||||
this.loadData()
|
||||
} else if (this.dataValue.length) {
|
||||
this.getTreePath((res) => {
|
||||
this.loadData()
|
||||
this._treeData = [];
|
||||
this.selectedIndex = 0;
|
||||
this.$nextTick(() => {
|
||||
this.loadData();
|
||||
})
|
||||
}
|
||||
},
|
||||
handleSelect(index) {
|
||||
this.selectedIndex = index
|
||||
this.selectedIndex = index;
|
||||
},
|
||||
handleNodeClick(item, i, j) {
|
||||
if (item.disable) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
const node = this.dataList[i][j]
|
||||
const text = node[this.map.text]
|
||||
const value = node[this.map.value]
|
||||
|
||||
const node = this.dataList[i][j];
|
||||
const text = node[this.map.text];
|
||||
const value = node[this.map.value];
|
||||
|
||||
if (i < this.selected.length - 1) {
|
||||
this.selected.splice(i, this.selected.length - i)
|
||||
this.selected.push({
|
||||
@ -124,18 +114,16 @@
|
||||
hasNodes
|
||||
} = this._updateBindData()
|
||||
|
||||
if (!this._isTreeView() && !hasNodes) {
|
||||
// 本地数据
|
||||
if (this.isLocalData) {
|
||||
this.onSelectedChange(node, (!hasNodes || isleaf))
|
||||
} else if (this.isCloudDataList) { // Cloud 数据 (单列)
|
||||
this.onSelectedChange(node, true)
|
||||
return
|
||||
}
|
||||
|
||||
if (this.isLocaldata && (!hasNodes || isleaf)) {
|
||||
this.onSelectedChange(node, true)
|
||||
return
|
||||
}
|
||||
|
||||
if (!isleaf && !hasNodes) {
|
||||
this._loadNodeData((data) => {
|
||||
} else if (this.isCloudDataTree) { // Cloud 数据 (树形)
|
||||
if (isleaf) {
|
||||
this.onSelectedChange(node, node.isleaf)
|
||||
} else if (!hasNodes) { // 请求一次服务器以确定是否为叶子节点
|
||||
this.loadCloudDataNode((data) => {
|
||||
if (!data.length) {
|
||||
node.isleaf = true
|
||||
} else {
|
||||
@ -143,11 +131,9 @@
|
||||
this._updateBindData(node)
|
||||
}
|
||||
this.onSelectedChange(node, node.isleaf)
|
||||
}, this._nodeWhere())
|
||||
return
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
this.onSelectedChange(node, false)
|
||||
},
|
||||
updateData(data) {
|
||||
this._treeData = data.treeData
|
||||
@ -160,7 +146,7 @@
|
||||
}
|
||||
},
|
||||
onDataChange() {
|
||||
this.$emit('datachange')
|
||||
this.$emit('datachange');
|
||||
},
|
||||
onSelectedChange(node, isleaf) {
|
||||
if (isleaf) {
|
||||
@ -177,7 +163,10 @@
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style >
|
||||
|
||||
<style lang="scss">
|
||||
$uni-primary: #007aff !default;
|
||||
|
||||
.uni-data-pickerview {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
@ -229,15 +218,14 @@
|
||||
.selected-area {
|
||||
width: 750rpx;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
|
||||
.selected-list {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
flex-wrap: nowrap;
|
||||
/* #endif */
|
||||
flex-direction: row;
|
||||
flex-wrap: nowrap;
|
||||
padding: 0 5px;
|
||||
border-bottom: 1px solid #f8f8f8;
|
||||
}
|
||||
@ -265,11 +253,11 @@
|
||||
}
|
||||
|
||||
.selected-item-active {
|
||||
border-bottom: 2px solid #007aff;
|
||||
border-bottom: 2px solid $uni-primary;
|
||||
}
|
||||
|
||||
.selected-item-text {
|
||||
color: #007aff;
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.tab-c {
|
||||
@ -319,7 +307,7 @@
|
||||
|
||||
.check {
|
||||
margin-right: 5px;
|
||||
border: 2px solid #007aff;
|
||||
border: 2px solid $uni-primary;
|
||||
border-left: 0;
|
||||
border-top: 0;
|
||||
height: 12px;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-data-picker",
|
||||
"displayName": "uni-data-picker 数据驱动的picker选择器",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.8",
|
||||
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -18,11 +18,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -39,7 +35,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
@ -56,7 +53,7 @@
|
||||
"client": {
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
"app-nvue": "u"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
|
@ -1,3 +1,9 @@
|
||||
## 0.1.9(2022-09-05)
|
||||
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
|
||||
## 0.1.8(2022-08-29)
|
||||
- 修复 点击的位置不准确
|
||||
## 0.1.7(2022-08-12)
|
||||
- 新增 支持 disabled 属性
|
||||
## 0.1.6(2022-07-06)
|
||||
- 修复 pc端宽度异常的bug
|
||||
## 0.1.5
|
||||
|
@ -2,7 +2,7 @@
|
||||
<view class="uni-stat__select">
|
||||
<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-select">
|
||||
<view class="uni-select" :class="{'uni-select--disabled':disabled}">
|
||||
<view class="uni-select__input-box" @click="toggleSelector">
|
||||
<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>
|
||||
@ -39,6 +39,7 @@
|
||||
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
|
||||
* @property {String} label 左侧标题
|
||||
* @property {String} placeholder 输入框的提示文字
|
||||
* @property {Boolean} disabled 是否禁用
|
||||
* @event {Function} change 选中发生变化触发
|
||||
*/
|
||||
|
||||
@ -88,6 +89,10 @@
|
||||
defItem: {
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
@ -204,6 +209,10 @@
|
||||
},
|
||||
|
||||
toggleSelector() {
|
||||
if(this.disabled){
|
||||
return
|
||||
}
|
||||
|
||||
this.showSelector = !this.showSelector
|
||||
},
|
||||
formatItemName(item) {
|
||||
@ -287,6 +296,11 @@
|
||||
width: 100%;
|
||||
flex: 1;
|
||||
height: 35px;
|
||||
|
||||
&--disabled{
|
||||
background-color: #f5f7fa;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-select__label {
|
||||
@ -298,7 +312,7 @@
|
||||
}
|
||||
|
||||
.uni-select__input-box {
|
||||
// height: 35px;
|
||||
height: 35px;
|
||||
position: relative;
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@ -332,7 +346,7 @@
|
||||
border: 1px solid #EBEEF5;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
z-index: 2;
|
||||
z-index: 3;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-data-select",
|
||||
"displayName": "uni-data-select 下拉框选择器",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.9",
|
||||
"description": "通过数据驱动的下拉框选择器",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-load-more"],
|
||||
|
@ -1,3 +1,13 @@
|
||||
## 2.2.11(2022-09-19)
|
||||
- 修复,支付宝小程序样式错乱,[详情](https://github.com/dcloudio/uni-app/issues/3861)
|
||||
## 2.2.10(2022-09-19)
|
||||
- 修复,反向选择日期范围,日期显示异常,[详情](https://ask.dcloud.net.cn/question/153401?item_id=212892&rf=false)
|
||||
## 2.2.9(2022-09-16)
|
||||
- 可以使用 uni-scss 控制主题色
|
||||
## 2.2.8(2022-09-08)
|
||||
- 修复 close事件无效的 bug
|
||||
## 2.2.7(2022-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.6(2022-06-30)
|
||||
- 优化 组件样式,调整了组件图标大小、高度、颜色等,与uni-ui风格保持一致
|
||||
## 2.2.5(2022-06-24)
|
||||
|
@ -62,6 +62,8 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
$uni-primary: #007aff !default;
|
||||
|
||||
.uni-calendar-item__weeks-box {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
@ -78,7 +80,7 @@
|
||||
font-size: 14px;
|
||||
// font-family: Lato-Bold, Lato;
|
||||
font-weight: bold;
|
||||
color: #455997;
|
||||
color: darken($color: $uni-primary, $amount: 40%);
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-lunar-text {
|
||||
@ -138,7 +140,7 @@
|
||||
}
|
||||
|
||||
.uni-calendar-item__weeks-box .uni-calendar-item--checked {
|
||||
background-color: #007aff;
|
||||
background-color: $uni-primary;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
border: 3px solid #fff;
|
||||
@ -159,7 +161,7 @@
|
||||
|
||||
.uni-calendar-item--multiple .uni-calendar-item--before-checked,
|
||||
.uni-calendar-item--multiple .uni-calendar-item--after-checked {
|
||||
background-color: #409eff;
|
||||
background-color: $uni-primary;
|
||||
border-radius: 50%;
|
||||
box-sizing: border-box;
|
||||
border: 3px solid #F6F7FC;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="uni-calendar" @mouseleave="leaveCale">
|
||||
<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"
|
||||
: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}">
|
||||
@ -74,7 +74,9 @@
|
||||
:hide-second="hideSecond" :disabled="!tempRange.before" class="time-picker-style">
|
||||
</time-picker>
|
||||
</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-date">{{tempRange.after ? tempRange.after : endDateText}}</view>
|
||||
<time-picker type="time" :end="reactEndTime" v-model="timeRange.endTime" :border="false"
|
||||
@ -411,6 +413,11 @@
|
||||
this.close()
|
||||
},
|
||||
|
||||
// 蒙版点击事件
|
||||
maskClick() {
|
||||
this.$emit('maskClose')
|
||||
},
|
||||
|
||||
clearCalender() {
|
||||
if (this.range) {
|
||||
this.timeRange.startTime = ''
|
||||
@ -546,8 +553,16 @@
|
||||
this.cale.setMultiple(this.calendar.fullDate, true)
|
||||
this.weeks = this.cale.weeks
|
||||
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.after = this.cale.multipleStatus.after
|
||||
}
|
||||
this.change()
|
||||
},
|
||||
/**
|
||||
@ -604,6 +619,8 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
$uni-primary: #007aff !default;
|
||||
|
||||
.uni-calendar {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@ -714,7 +731,7 @@
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
font-size: 14px;
|
||||
color: #007aff;
|
||||
color: $uni-primary;
|
||||
/* #ifndef APP-NVUE */
|
||||
letter-spacing: 3px;
|
||||
/* #endif */
|
||||
@ -893,7 +910,7 @@
|
||||
border-radius: 100px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
background-color: #007aff;
|
||||
background-color: $uni-primary;
|
||||
color: #fff;
|
||||
font-size: 16px;
|
||||
letter-spacing: 2px;
|
||||
|
@ -185,6 +185,7 @@
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// #ifndef VUE3
|
||||
value: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal) {
|
||||
@ -197,6 +198,21 @@
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// #endif
|
||||
// #ifdef VUE3
|
||||
modelValue: {
|
||||
handler(newVal, oldVal) {
|
||||
if (newVal) {
|
||||
this.parseValue(this.fixIosDateFormat(newVal)) //兼容 iOS、safari 日期格式
|
||||
this.initTime(false)
|
||||
} else {
|
||||
this.time = ''
|
||||
this.parseValue(Date.now())
|
||||
}
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
// #endif
|
||||
type: {
|
||||
handler(newValue) {
|
||||
if (newValue === 'date') {
|
||||
@ -770,7 +786,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
$uni-primary: #007aff !default;
|
||||
|
||||
.uni-datetime-picker {
|
||||
/* #ifndef APP-NVUE */
|
||||
/* width: 100%; */
|
||||
@ -804,7 +822,7 @@
|
||||
|
||||
.uni-datetime-picker-btn-text {
|
||||
font-size: 14px;
|
||||
color: #007AFF;
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.uni-datetime-picker-btn-group {
|
||||
@ -889,6 +907,7 @@
|
||||
|
||||
.uni-datetime-picker-text {
|
||||
font-size: 14px;
|
||||
line-height: 50px
|
||||
}
|
||||
|
||||
.uni-datetime-picker-sign {
|
||||
|
@ -91,7 +91,7 @@
|
||||
<calendar v-show="isPhone" ref="mobile" :clearDate="false" :date="defSingleDate" :defTime="reactMobDefTime"
|
||||
:start-date="caleRange.startDate" :end-date="caleRange.endDate" :selectableTimes="mobSelectableTime"
|
||||
:pleStatus="endMultipleStatus" :showMonth="false" :range="isRange" :typeHasTime="hasTime" :insert="false"
|
||||
:hideSecond="hideSecond" @confirm="mobileChange" />
|
||||
:hideSecond="hideSecond" @confirm="mobileChange" @maskClose="close" />
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
@ -516,6 +516,7 @@
|
||||
setTimeout(() => {
|
||||
this.popup = false
|
||||
this.$emit('maskClick', this.value)
|
||||
this.$refs.mobile.close()
|
||||
}, 20)
|
||||
},
|
||||
setEmit(value) {
|
||||
@ -782,7 +783,9 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
<style lang="scss">
|
||||
$uni-primary: #007aff !default;
|
||||
|
||||
.uni-date {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
@ -941,14 +944,14 @@
|
||||
}
|
||||
|
||||
.popup-x-footer text:hover {
|
||||
color: #007aff;
|
||||
color: $uni-primary;
|
||||
cursor: pointer;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.popup-x-footer .confirm {
|
||||
margin-left: 20px;
|
||||
color: #007aff;
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.uni-date-changed {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-datetime-picker",
|
||||
"displayName": "uni-datetime-picker 日期选择器",
|
||||
"version": "2.2.6",
|
||||
"version": "2.2.11",
|
||||
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
|
||||
"keywords": [
|
||||
"uni-datetime-picker",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
|
@ -1,47 +1,86 @@
|
||||
## 1.1.0(2022-06-30)
|
||||
|
||||
- 新增 在 uni-forms 1.4.0 中使用可以在 blur 时校验内容
|
||||
- 新增 clear 事件,点击右侧叉号图标触发
|
||||
- 新增 change 事件 ,仅在输入框失去焦点或用户按下回车时触发
|
||||
- 优化 组件样式,组件获取焦点时高亮显示,图标颜色调整等
|
||||
-
|
||||
|
||||
## 1.0.5(2022-06-07)
|
||||
|
||||
- 优化 clearable 显示策略
|
||||
|
||||
## 1.0.4(2022-06-07)
|
||||
|
||||
- 优化 clearable 显示策略
|
||||
|
||||
## 1.0.3(2022-05-20)
|
||||
- 修复 关闭图标某些情况下无法取消的bug
|
||||
|
||||
- 修复 关闭图标某些情况下无法取消的 bug
|
||||
|
||||
## 1.0.2(2022-04-12)
|
||||
- 修复 默认值不生效的bug
|
||||
|
||||
- 修复 默认值不生效的 bug
|
||||
|
||||
## 1.0.1(2022-04-02)
|
||||
- 修复 value不能为0的bug
|
||||
|
||||
- 修复 value 不能为 0 的 bug
|
||||
|
||||
## 1.0.0(2021-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)
|
||||
|
||||
## 0.1.4(2021-08-20)
|
||||
|
||||
- 修复 在 uni-forms 的动态表单中默认值校验不通过的 bug
|
||||
|
||||
## 0.1.3(2021-08-11)
|
||||
|
||||
- 修复 在 uni-forms 中重置表单,错误信息无法清除的问题
|
||||
|
||||
## 0.1.2(2021-07-30)
|
||||
- 优化 vue3下事件警告的问题
|
||||
|
||||
- 优化 vue3 下事件警告的问题
|
||||
|
||||
## 0.1.1
|
||||
|
||||
- 优化 errorMessage 属性支持 Boolean 类型
|
||||
|
||||
## 0.1.0(2021-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.16(2021-06-29)
|
||||
|
||||
- 修复 confirmType 属性(仅 type="text" 生效)导致多行文本框无法换行的 bug
|
||||
|
||||
## 0.0.15(2021-06-21)
|
||||
|
||||
- 修复 passwordIcon 属性拼写错误的 bug
|
||||
|
||||
## 0.0.14(2021-06-18)
|
||||
- 新增 passwordIcon 属性,当type=password时是否显示小眼睛图标
|
||||
|
||||
- 新增 passwordIcon 属性,当 type=password 时是否显示小眼睛图标
|
||||
- 修复 confirmType 属性不生效的问题
|
||||
|
||||
## 0.0.13(2021-06-04)
|
||||
|
||||
- 修复 disabled 状态可清出内容的 bug
|
||||
|
||||
## 0.0.12(2021-05-12)
|
||||
|
||||
- 新增 组件示例地址
|
||||
|
||||
## 0.0.11(2021-05-07)
|
||||
|
||||
- 修复 input-border 属性不生效的问题
|
||||
|
||||
## 0.0.10(2021-04-30)
|
||||
|
||||
- 修复 ios 遮挡文字、显示一半的问题
|
||||
|
||||
## 0.0.9(2021-02-05)
|
||||
- 调整为uni_modules目录规范
|
||||
|
||||
- 调整为 uni_modules 目录规范
|
||||
- 优化 兼容 nvue 页面
|
||||
|
@ -1,34 +1,97 @@
|
||||
<template>
|
||||
<view class="uni-easyinput" :class="{'uni-easyinput-error':msg}" :style="boxStyle">
|
||||
<view class="uni-easyinput__content" :class="inputContentClass" :style="inputContentStyle">
|
||||
<uni-icons v-if="prefixIcon" class="content-clear-icon" :type="prefixIcon" color="#c0c4cc"
|
||||
@click="onClickIcon('prefix')" size="22"></uni-icons>
|
||||
<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" />
|
||||
<view
|
||||
class="uni-easyinput"
|
||||
:class="{ 'uni-easyinput-error': msg }"
|
||||
:style="boxStyle"
|
||||
>
|
||||
<view
|
||||
class="uni-easyinput__content"
|
||||
:class="inputContentClass"
|
||||
:style="inputContentStyle"
|
||||
>
|
||||
<slot name="prefixIcon">
|
||||
<uni-icons
|
||||
v-if="prefixIcon"
|
||||
class="content-clear-icon"
|
||||
: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">
|
||||
<!-- 开启密码时显示小眼睛 -->
|
||||
<uni-icons v-if="isVal" class="content-clear-icon" :class="{'is-textarea-icon':type==='textarea'}"
|
||||
:type="showPassword?'eye-slash-filled':'eye-filled'" :size="22"
|
||||
:color="focusShow?'#2979ff':'#c0c4cc'" @click="onEyes">
|
||||
<uni-icons
|
||||
v-if="isVal"
|
||||
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>
|
||||
</template>
|
||||
<template v-else-if="suffixIcon">
|
||||
<uni-icons v-if="suffixIcon" class="content-clear-icon" :type="suffixIcon" color="#c0c4cc"
|
||||
@click="onClickIcon('suffix')" size="22"></uni-icons>
|
||||
<template v-else-if="suffixIcon || $slots.suffixIcon">
|
||||
<slot name="suffixIcon">
|
||||
<uni-icons
|
||||
v-if="suffixIcon"
|
||||
class="content-clear-icon"
|
||||
:type="suffixIcon"
|
||||
color="#c0c4cc"
|
||||
@click="onClickIcon('suffix')"
|
||||
size="22"
|
||||
></uni-icons>
|
||||
</slot>
|
||||
</template>
|
||||
<template v-else>
|
||||
<uni-icons v-if="clearable && isVal && !disabled && type !== 'textarea'" class="content-clear-icon"
|
||||
:class="{'is-textarea-icon':type==='textarea'}" type="clear" :size="clearSize"
|
||||
:color="msg?'#dd524d':(focusShow?'#2979ff':'#c0c4cc')" @click="onClear"></uni-icons>
|
||||
<uni-icons
|
||||
v-if="clearable && isVal && !disabled && type !== 'textarea'"
|
||||
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>
|
||||
<slot name="right"></slot>
|
||||
</view>
|
||||
@ -36,7 +99,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/**
|
||||
/**
|
||||
* Easyinput 输入框
|
||||
* @description 此组件可以实现表单的输入与校验,包括 "text" 和 "textarea" 类型。
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=3455
|
||||
@ -59,6 +122,7 @@
|
||||
* @property {Number } clearSize 清除图标的大小,单位px(默认15)
|
||||
* @property {String} prefixIcon 输入框头部图标
|
||||
* @property {String} suffixIcon 输入框尾部图标
|
||||
* @property {String} primaryColor 设置主题色(默认#2979ff)
|
||||
* @property {Boolean} trim 是否自动去除两端的空格
|
||||
* @value both 去除两端空格
|
||||
* @value left 去除左侧空格
|
||||
@ -75,45 +139,58 @@
|
||||
* @event {Function} blur 输入框失去焦点时触发
|
||||
* @event {Function} confirm 点击完成按钮时触发
|
||||
* @event {Function} iconClick 点击图标时触发
|
||||
* @slot prefixIcon 输入框头部插槽
|
||||
* @slot suffixIcon 输入框尾部插槽
|
||||
* @example <uni-easyinput v-model="mobile"></uni-easyinput>
|
||||
*/
|
||||
function obj2strClass(obj) {
|
||||
let classess = ''
|
||||
function obj2strClass(obj) {
|
||||
let classess = "";
|
||||
for (let key in obj) {
|
||||
const val = obj[key]
|
||||
const val = obj[key];
|
||||
if (val) {
|
||||
classess += `${key} `
|
||||
classess += `${key} `;
|
||||
}
|
||||
}
|
||||
return classess
|
||||
}
|
||||
return classess;
|
||||
}
|
||||
|
||||
function obj2strStyle(obj) {
|
||||
let style = ''
|
||||
function obj2strStyle(obj) {
|
||||
let style = "";
|
||||
for (let key in obj) {
|
||||
const val = obj[key]
|
||||
style += `${key}:${val};`
|
||||
const val = obj[key];
|
||||
style += `${key}:${val};`;
|
||||
}
|
||||
return style
|
||||
}
|
||||
export default {
|
||||
name: 'uni-easyinput',
|
||||
emits: ['click', 'iconClick', 'update:modelValue', 'input', 'focus', 'blur', 'confirm', 'clear', 'eyes', 'change'],
|
||||
return style;
|
||||
}
|
||||
export default {
|
||||
name: "uni-easyinput",
|
||||
emits: [
|
||||
"click",
|
||||
"iconClick",
|
||||
"update:modelValue",
|
||||
"input",
|
||||
"focus",
|
||||
"blur",
|
||||
"confirm",
|
||||
"clear",
|
||||
"eyes",
|
||||
"change",
|
||||
],
|
||||
model: {
|
||||
prop: 'modelValue',
|
||||
event: 'update:modelValue'
|
||||
prop: "modelValue",
|
||||
event: "update:modelValue",
|
||||
},
|
||||
options: {
|
||||
virtualHost: true
|
||||
virtualHost: true,
|
||||
},
|
||||
inject: {
|
||||
form: {
|
||||
from: 'uniForm',
|
||||
default: null
|
||||
from: "uniForm",
|
||||
default: null,
|
||||
},
|
||||
formItem: {
|
||||
from: 'uniFormItem',
|
||||
default: null
|
||||
from: "uniFormItem",
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
props: {
|
||||
@ -122,98 +199,102 @@
|
||||
modelValue: [Number, String],
|
||||
type: {
|
||||
type: String,
|
||||
default: 'text'
|
||||
default: "text",
|
||||
},
|
||||
clearable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
autoHeight: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: ' '
|
||||
default: " ",
|
||||
},
|
||||
placeholderStyle: String,
|
||||
focus: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
maxlength: {
|
||||
type: [Number, String],
|
||||
default: 140
|
||||
default: 140,
|
||||
},
|
||||
confirmType: {
|
||||
type: String,
|
||||
default: 'done'
|
||||
default: "done",
|
||||
},
|
||||
clearSize: {
|
||||
type: [Number, String],
|
||||
default: 24
|
||||
default: 24,
|
||||
},
|
||||
inputBorder: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
prefixIcon: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
suffixIcon: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: "",
|
||||
},
|
||||
trim: {
|
||||
type: [Boolean, String],
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
passwordIcon: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
primaryColor: {
|
||||
type: String,
|
||||
default: "#2979ff",
|
||||
},
|
||||
styles: {
|
||||
type: Object,
|
||||
default () {
|
||||
default() {
|
||||
return {
|
||||
color: '#333',
|
||||
disableColor: '#F7F6F6',
|
||||
borderColor: '#e5e5e5'
|
||||
}
|
||||
}
|
||||
color: "#333",
|
||||
disableColor: "#F7F6F6",
|
||||
borderColor: "#e5e5e5",
|
||||
};
|
||||
},
|
||||
},
|
||||
errorMessage: {
|
||||
type: [String, Boolean],
|
||||
default: ''
|
||||
}
|
||||
default: "",
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
focused: false,
|
||||
val: '',
|
||||
showMsg: '',
|
||||
val: "",
|
||||
showMsg: "",
|
||||
border: false,
|
||||
isFirstBorder: false,
|
||||
showClearIcon: false,
|
||||
showPassword: false,
|
||||
focusShow: false,
|
||||
localMsg: ''
|
||||
localMsg: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 输入框内是否有值
|
||||
isVal() {
|
||||
const val = this.val
|
||||
const val = this.val;
|
||||
// fixed by mehaotian 处理值为0的情况,字符串0不在处理范围
|
||||
if (val || val === 0) {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
return false
|
||||
return false;
|
||||
},
|
||||
|
||||
msg() {
|
||||
@ -222,7 +303,7 @@
|
||||
// return this.errorMessage || this.formItem.errMsg;
|
||||
// }
|
||||
// TODO 处理头条 formItem 中 errMsg 不更新的问题
|
||||
return this.localMsg || this.errorMessage
|
||||
return this.localMsg || this.errorMessage;
|
||||
},
|
||||
// 因为uniapp的input组件的maxlength组件必须要数值,这里转为数值,用户可以传入字符串数值
|
||||
inputMaxlength() {
|
||||
@ -231,62 +312,71 @@
|
||||
|
||||
// 处理外层样式的style
|
||||
boxStyle() {
|
||||
return `color:${this.inputBorder && this.msg?'#e43d33':this.styles.color};`
|
||||
return `color:${
|
||||
this.inputBorder && this.msg ? "#e43d33" : this.styles.color
|
||||
};`;
|
||||
},
|
||||
// input 内容的类和样式处理
|
||||
inputContentClass() {
|
||||
return obj2strClass({
|
||||
'is-input-border': this.inputBorder,
|
||||
'is-input-error-border': this.inputBorder && this.msg,
|
||||
'is-textarea': this.type === 'textarea',
|
||||
'is-disabled': this.disabled
|
||||
})
|
||||
"is-input-border": this.inputBorder,
|
||||
"is-input-error-border": this.inputBorder && this.msg,
|
||||
"is-textarea": this.type === "textarea",
|
||||
"is-disabled": this.disabled,
|
||||
});
|
||||
},
|
||||
inputContentStyle() {
|
||||
const focusColor = this.focusShow ? '#2979ff' : this.styles.borderColor
|
||||
const borderColor = this.inputBorder && this.msg ? '#dd524d' : focusColor
|
||||
const focusColor = this.focusShow
|
||||
? this.primaryColor
|
||||
: this.styles.borderColor;
|
||||
const borderColor = this.inputBorder && this.msg ? "#dd524d" : focusColor;
|
||||
return obj2strStyle({
|
||||
'border-color': borderColor || '#e5e5e5',
|
||||
'background-color': this.disabled ? this.styles.disableColor : '#fff'
|
||||
})
|
||||
"border-color": borderColor || "#e5e5e5",
|
||||
"background-color": this.disabled
|
||||
? this.styles.disableColor
|
||||
: this.styles.backgroundColor,
|
||||
});
|
||||
},
|
||||
// input右侧样式
|
||||
inputStyle() {
|
||||
const paddingRight = this.type === 'password' || this.clearable || this.prefixIcon ? '' : '10px'
|
||||
const paddingRight =
|
||||
this.type === "password" || this.clearable || this.prefixIcon
|
||||
? ""
|
||||
: "10px";
|
||||
return obj2strStyle({
|
||||
'padding-right': paddingRight,
|
||||
'padding-left': this.prefixIcon ? '' : '10px'
|
||||
})
|
||||
}
|
||||
"padding-right": paddingRight,
|
||||
"padding-left": this.prefixIcon ? "" : "10px",
|
||||
});
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value(newVal) {
|
||||
this.val = newVal
|
||||
this.val = newVal;
|
||||
},
|
||||
modelValue(newVal) {
|
||||
this.val = newVal
|
||||
this.val = newVal;
|
||||
},
|
||||
focus(newVal) {
|
||||
this.$nextTick(() => {
|
||||
this.focused = this.focus
|
||||
this.focusShow = this.focus
|
||||
})
|
||||
}
|
||||
this.focused = this.focus;
|
||||
this.focusShow = this.focus;
|
||||
});
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.init()
|
||||
this.init();
|
||||
// TODO 处理头条vue3 computed 不监听 inject 更改的问题(formItem.errMsg)
|
||||
if (this.form && this.formItem) {
|
||||
this.$watch('formItem.errMsg', (newVal) => {
|
||||
this.localMsg = newVal
|
||||
})
|
||||
this.$watch("formItem.errMsg", (newVal) => {
|
||||
this.localMsg = newVal;
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.focused = this.focus
|
||||
this.focusShow = this.focus
|
||||
})
|
||||
this.focused = this.focus;
|
||||
this.focusShow = this.focus;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
@ -294,11 +384,11 @@
|
||||
*/
|
||||
init() {
|
||||
if (this.value || this.value === 0) {
|
||||
this.val = this.value
|
||||
this.val = this.value;
|
||||
} else if (this.modelValue || this.modelValue === 0) {
|
||||
this.val = this.modelValue
|
||||
this.val = this.modelValue;
|
||||
} else {
|
||||
this.val = null
|
||||
this.val = null;
|
||||
}
|
||||
},
|
||||
|
||||
@ -307,15 +397,15 @@
|
||||
* @param {Object} type
|
||||
*/
|
||||
onClickIcon(type) {
|
||||
this.$emit('iconClick', type)
|
||||
this.$emit("iconClick", type);
|
||||
},
|
||||
|
||||
/**
|
||||
* 显示隐藏内容,密码框时生效
|
||||
*/
|
||||
onEyes() {
|
||||
this.showPassword = !this.showPassword
|
||||
this.$emit('eyes', this.showPassword)
|
||||
this.showPassword = !this.showPassword;
|
||||
this.$emit("eyes", this.showPassword);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -326,19 +416,19 @@
|
||||
let value = event.detail.value;
|
||||
// 判断是否去除空格
|
||||
if (this.trim) {
|
||||
if (typeof(this.trim) === 'boolean' && this.trim) {
|
||||
value = this.trimStr(value)
|
||||
if (typeof this.trim === "boolean" && this.trim) {
|
||||
value = this.trimStr(value);
|
||||
}
|
||||
if (typeof(this.trim) === 'string') {
|
||||
value = this.trimStr(value, this.trim)
|
||||
if (typeof this.trim === "string") {
|
||||
value = this.trimStr(value, this.trim);
|
||||
}
|
||||
};
|
||||
if (this.errMsg) this.errMsg = ''
|
||||
this.val = value
|
||||
}
|
||||
if (this.errMsg) this.errMsg = "";
|
||||
this.val = value;
|
||||
// TODO 兼容 vue2
|
||||
this.$emit('input', value);
|
||||
this.$emit("input", value);
|
||||
// TODO 兼容 vue3
|
||||
this.$emit('update:modelValue', value)
|
||||
this.$emit("update:modelValue", value);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -348,14 +438,14 @@
|
||||
*/
|
||||
onFocus() {
|
||||
this.$nextTick(() => {
|
||||
this.focused = true
|
||||
})
|
||||
this.$emit('focus', null);
|
||||
this.focused = true;
|
||||
});
|
||||
this.$emit("focus", null);
|
||||
},
|
||||
|
||||
_Focus(event) {
|
||||
this.focusShow = true
|
||||
this.$emit('focus', event);
|
||||
this.focusShow = true;
|
||||
this.$emit("focus", event);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -364,22 +454,20 @@
|
||||
* @param {Object} event
|
||||
*/
|
||||
onBlur() {
|
||||
this.focused = false
|
||||
this.$emit('focus', null);
|
||||
this.focused = false;
|
||||
this.$emit("focus", null);
|
||||
},
|
||||
_Blur(event) {
|
||||
let value = event.detail.value;
|
||||
this.focusShow = false
|
||||
this.$emit('blur', event);
|
||||
this.focusShow = false;
|
||||
this.$emit("blur", event);
|
||||
// 根据类型返回值,在event中获取的值理论上讲都是string
|
||||
this.$emit('change', this.val)
|
||||
this.$emit("change", this.val);
|
||||
// 失去焦点时参与表单校验
|
||||
if (this.form && this.formItem) {
|
||||
const {
|
||||
validateTrigger
|
||||
} = this.form
|
||||
if (validateTrigger === 'blur') {
|
||||
this.formItem.onFieldChange()
|
||||
const { validateTrigger } = this.form;
|
||||
if (validateTrigger === "blur") {
|
||||
this.formItem.onFieldChange();
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -389,8 +477,8 @@
|
||||
* @param {Object} e
|
||||
*/
|
||||
onConfirm(e) {
|
||||
this.$emit('confirm', this.val);
|
||||
this.$emit('change', this.val)
|
||||
this.$emit("confirm", this.val);
|
||||
this.$emit("change", this.val);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -398,46 +486,46 @@
|
||||
* @param {Object} event
|
||||
*/
|
||||
onClear(event) {
|
||||
this.val = '';
|
||||
this.val = "";
|
||||
// TODO 兼容 vue2
|
||||
this.$emit('input', '');
|
||||
this.$emit("input", "");
|
||||
// TODO 兼容 vue2
|
||||
// TODO 兼容 vue3
|
||||
this.$emit('update:modelValue', '')
|
||||
this.$emit("update:modelValue", "");
|
||||
// 点击叉号触发
|
||||
this.$emit('clear')
|
||||
this.$emit("clear");
|
||||
},
|
||||
|
||||
/**
|
||||
* 去除空格
|
||||
*/
|
||||
trimStr(str, pos = 'both') {
|
||||
if (pos === 'both') {
|
||||
trimStr(str, pos = "both") {
|
||||
if (pos === "both") {
|
||||
return str.trim();
|
||||
} else if (pos === 'left') {
|
||||
} else if (pos === "left") {
|
||||
return str.trimLeft();
|
||||
} else if (pos === 'right') {
|
||||
} else if (pos === "right") {
|
||||
return str.trimRight();
|
||||
} else if (pos === 'start') {
|
||||
return str.trimStart()
|
||||
} else if (pos === 'end') {
|
||||
return str.trimEnd()
|
||||
} else if (pos === 'all') {
|
||||
return str.replace(/\s+/g, '');
|
||||
} else if (pos === 'none') {
|
||||
} else if (pos === "start") {
|
||||
return str.trimStart();
|
||||
} else if (pos === "end") {
|
||||
return str.trimEnd();
|
||||
} else if (pos === "all") {
|
||||
return str.replace(/\s+/g, "");
|
||||
} else if (pos === "none") {
|
||||
return str;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
$uni-error: #e43d33;
|
||||
$uni-border-1: #DCDFE6 !default;
|
||||
$uni-error: #e43d33;
|
||||
$uni-border-1: #dcdfe6 !default;
|
||||
|
||||
.uni-easyinput {
|
||||
.uni-easyinput {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
/* #endif */
|
||||
@ -446,9 +534,9 @@
|
||||
text-align: left;
|
||||
color: #333;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-easyinput__content {
|
||||
.uni-easyinput__content {
|
||||
flex: 1;
|
||||
/* #ifndef APP-NVUE */
|
||||
width: 100%;
|
||||
@ -462,9 +550,9 @@
|
||||
border-color: #fff;
|
||||
transition-property: border-color;
|
||||
transition-duration: 0.3s;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-easyinput__content-input {
|
||||
.uni-easyinput__content-input {
|
||||
/* #ifndef APP-NVUE */
|
||||
width: auto;
|
||||
/* #endif */
|
||||
@ -475,23 +563,23 @@
|
||||
font-size: 14px;
|
||||
height: 35px;
|
||||
// min-height: 36px;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
.uni-easyinput__placeholder-class {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
// font-weight: 200;
|
||||
}
|
||||
}
|
||||
|
||||
.is-textarea {
|
||||
.is-textarea {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
.is-textarea-icon {
|
||||
.is-textarea-icon {
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-easyinput__content-textarea {
|
||||
.uni-easyinput__content-textarea {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
@ -505,23 +593,23 @@
|
||||
min-height: 80px;
|
||||
width: auto;
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
|
||||
.input-padding {
|
||||
.input-padding {
|
||||
padding-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.content-clear-icon {
|
||||
.content-clear-icon {
|
||||
padding: 0 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.label-icon {
|
||||
.label-icon {
|
||||
margin-right: 5px;
|
||||
margin-top: -1px;
|
||||
}
|
||||
}
|
||||
|
||||
// 显示边框
|
||||
.is-input-border {
|
||||
// 显示边框
|
||||
.is-input-border {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
@ -533,9 +621,9 @@
|
||||
/* #ifdef MP-ALIPAY */
|
||||
overflow: hidden;
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
|
||||
.uni-error-message {
|
||||
.uni-error-message {
|
||||
position: absolute;
|
||||
bottom: -17px;
|
||||
left: 0;
|
||||
@ -543,51 +631,49 @@
|
||||
color: $uni-error;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-error-msg--boeder {
|
||||
.uni-error-msg--boeder {
|
||||
position: relative;
|
||||
bottom: 0;
|
||||
line-height: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
.is-input-error-border {
|
||||
.is-input-error-border {
|
||||
border-color: $uni-error;
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
color: mix(#fff, $uni-error, 50%);
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.uni-easyinput--border {
|
||||
.uni-easyinput--border {
|
||||
margin-bottom: 0;
|
||||
padding: 10px 15px;
|
||||
// padding-bottom: 0;
|
||||
border-top: 1px #eee solid;
|
||||
}
|
||||
}
|
||||
|
||||
.uni-easyinput-error {
|
||||
.uni-easyinput-error {
|
||||
padding-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.is-first-border {
|
||||
.is-first-border {
|
||||
/* #ifndef APP-NVUE */
|
||||
border: none;
|
||||
/* #endif */
|
||||
/* #ifdef APP-NVUE */
|
||||
border-width: 0;
|
||||
/* #endif */
|
||||
}
|
||||
}
|
||||
|
||||
.is-disabled {
|
||||
background-color: #F7F6F6;
|
||||
color: #D5D5D5;
|
||||
.is-disabled {
|
||||
background-color: #f7f6f6;
|
||||
color: #d5d5d5;
|
||||
|
||||
.uni-easyinput__placeholder-class {
|
||||
color: #D5D5D5;
|
||||
color: #d5d5d5;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-easyinput",
|
||||
"displayName": "uni-easyinput 增强输入框",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.3",
|
||||
"description": "Easyinput 组件是对原生input组件的增强",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 1.2.4(2022-09-07)
|
||||
小程序端由于 style 使用了对象导致报错,[详情](https://ask.dcloud.net.cn/question/152790?item_id=211778&rf=false)
|
||||
## 1.2.3(2022-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.2(2021-12-29)
|
||||
- 更新 组件依赖
|
||||
## 1.2.1(2021-11-19)
|
||||
|
@ -5,7 +5,9 @@
|
||||
'uni-fab--rightBottom': rightBottom,
|
||||
'uni-fab--leftTop': leftTop,
|
||||
'uni-fab--rightTop': rightTop
|
||||
}" class="uni-fab">
|
||||
}" class="uni-fab"
|
||||
:style="nvueBottom"
|
||||
>
|
||||
<view :class="{
|
||||
'uni-fab__content--left': horizontal === 'left',
|
||||
'uni-fab__content--right': horizontal === 'right',
|
||||
@ -32,7 +34,7 @@
|
||||
'uni-fab__circle--leftTop': leftTop,
|
||||
'uni-fab__circle--rightTop': rightTop,
|
||||
'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"
|
||||
: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>
|
||||
@ -158,6 +160,16 @@
|
||||
},
|
||||
horizontalRight() {
|
||||
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: {
|
||||
@ -194,6 +206,9 @@
|
||||
* 按钮点击事件
|
||||
*/
|
||||
_onItemClick(index, item) {
|
||||
if (!this.isShow) {
|
||||
return
|
||||
}
|
||||
this.$emit('trigger', {
|
||||
index,
|
||||
item
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-fab",
|
||||
"displayName": "uni-fab 悬浮按钮",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.4",
|
||||
"description": "悬浮按钮 fab button ,点击可展开一个图标按钮菜单。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-scss","uni-icons"],
|
||||
|
@ -1,3 +1,7 @@
|
||||
## 1.4.8(2022-08-23)
|
||||
- 优化 根据 rules 自动添加 required 的问题
|
||||
## 1.4.7(2022-08-22)
|
||||
- 修复 item 未设置 require 属性,rules 设置 require 后,星号也显示的 bug,详见:[https://ask.dcloud.net.cn/question/151540](https://ask.dcloud.net.cn/question/151540)
|
||||
## 1.4.6(2022-07-13)
|
||||
- 修复 model 需要校验的值没有声明对应字段时,导致第一次不触发校验的bug
|
||||
## 1.4.5(2022-07-05)
|
||||
|
@ -387,9 +387,13 @@
|
||||
|
||||
// 是否显示星号
|
||||
_isRequired() {
|
||||
if (this.form) {
|
||||
return this.required || this.form._isRequiredField(this.itemRules.rules || [])
|
||||
}
|
||||
// TODO 不根据规则显示 星号,考虑后续兼容
|
||||
// if (this.form) {
|
||||
// if (this.form._isRequiredField(this.itemRules.rules || []) && this.required) {
|
||||
// return true
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
return this.required
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-forms",
|
||||
"displayName": "uni-forms 表单",
|
||||
"version": "1.4.6",
|
||||
"version": "1.4.8",
|
||||
"description": "由输入框、选择器、单选框、多选框等控件组成,用以收集、校验、提交数据",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
|
@ -1,3 +1,9 @@
|
||||
## 1.3.9(2022-10-13)
|
||||
- 修复 条件编译错误的bug
|
||||
## 1.3.8(2022-10-12)
|
||||
- 修复 nvue 环境 fixed 为 true 的情况下,无法置顶的 bug
|
||||
## 1.3.7(2022-08-11)
|
||||
- 修复 nvue 环境下 fixed 为 true 的情况下,无法置顶的 bug
|
||||
## 1.3.6(2022-06-30)
|
||||
- 修复 组件示例中插槽用法无法显示内容的bug
|
||||
## 1.3.5(2022-05-24)
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<view class="uni-navbar" :class="{'uni-dark':dark}">
|
||||
<view :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||
:style="{ 'background-color': themeBgColor }" class="uni-navbar__content">
|
||||
<view class="uni-navbar" :class="{'uni-dark':dark, 'uni-nvue-fixed': fixed}">
|
||||
<view class="uni-navbar__content" :class="{ 'uni-navbar--fixed': fixed, 'uni-navbar--shadow': shadow, 'uni-navbar--border': border }"
|
||||
:style="{ 'background-color': themeBgColor }" >
|
||||
<status-bar v-if="statusBar" />
|
||||
<view :style="{ color: themeColor,backgroundColor: themeBgColor ,height:navbarHeight}"
|
||||
class="uni-navbar__header">
|
||||
@ -38,10 +38,12 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<view class="uni-navbar__placeholder" v-if="fixed">
|
||||
<status-bar v-if="statusBar" />
|
||||
<view class="uni-navbar__placeholder-view" :style="{ height:navbarHeight}" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -50,6 +52,8 @@
|
||||
const getVal = (val) => typeof val === 'number' ? val + 'px' : val;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* NavBar 自定义导航栏
|
||||
* @description 导航栏组件,主要用于头部导航
|
||||
* @tutorial https://ext.dcloud.net.cn/plugin?id=52
|
||||
@ -196,6 +200,11 @@
|
||||
<style lang="scss" scoped>
|
||||
$nav-height: 44px;
|
||||
|
||||
.uni-nvue-fixed {
|
||||
/* #ifdef APP-NVUE */
|
||||
position: sticky;
|
||||
/* #endif */
|
||||
}
|
||||
.uni-navbar {
|
||||
// box-sizing: border-box;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-nav-bar",
|
||||
"displayName": "uni-nav-bar 自定义导航栏",
|
||||
"version": "1.3.6",
|
||||
"version": "1.3.9",
|
||||
"description": "自定义导航栏组件,主要用于头部导航。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -16,11 +16,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -37,7 +33,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
|
@ -1,3 +1,5 @@
|
||||
## 1.2.1(2022-09-05)
|
||||
- 新增 属性 fontSize,可修改文字大小。
|
||||
## 1.2.0(2021-11-19)
|
||||
- 优化 组件UI,并提供设计资源,详见:[https://uniapp.dcloud.io/component/uniui/resource](https://uniapp.dcloud.io/component/uniui/resource)
|
||||
- 文档迁移,详见:[https://uniapp.dcloud.io/component/uniui/uni-notice-bar](https://uniapp.dcloud.io/component/uniui/uni-notice-bar)
|
||||
|
@ -1,24 +1,47 @@
|
||||
<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"
|
||||
:color="color" size="22" />
|
||||
:color="color" :size="fontSize * 1.5" />
|
||||
<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"
|
||||
: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"
|
||||
:class="{'uni-noticebar__content-text--scrollable':scrollable,'uni-noticebar__content-text--single':!scrollable && (single || showGetMore)}"
|
||||
: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>
|
||||
:class="{
|
||||
'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 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">
|
||||
<text v-if="moreText.length > 0" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}</text>
|
||||
<uni-icons v-else type="right" :color="moreColor" size="16" />
|
||||
<text v-if="moreText.length > 0" :style="{ color: moreColor, fontSize: fontSize + 'px' }">{{ moreText }}</text>
|
||||
<uni-icons v-else type="right" :color="moreColor" :size="fontSize * 1.1" />
|
||||
</view>
|
||||
<view class="uni-noticebar-close uni-cursor-point" v-if="(showClose === true || showClose === 'true') && (showGetMore === false || showGetMore === 'false')">
|
||||
<uni-icons
|
||||
type="closeempty" :color="color" size="16" @click="close" />
|
||||
<view class="uni-noticebar-close uni-cursor-point" v-if="isShowClose">
|
||||
<uni-icons type="closeempty" :color="color" :size="fontSize * 1.1" @click="close" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@ -74,6 +97,10 @@
|
||||
type: String,
|
||||
default: '#FF9A43'
|
||||
},
|
||||
fontSize: {
|
||||
type: Number,
|
||||
default: 14
|
||||
},
|
||||
moreColor: {
|
||||
type: String,
|
||||
default: '#FF9A43'
|
||||
@ -123,6 +150,15 @@
|
||||
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() {
|
||||
// #ifdef APP-PLUS
|
||||
var pages = getCurrentPages();
|
||||
@ -262,7 +298,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
<style lang="scss" scoped>
|
||||
.uni-noticebar {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@ -310,7 +346,6 @@
|
||||
/* #ifndef APP-NVUE */
|
||||
.uni-noticebar__content-wrapper--scrollable {
|
||||
position: relative;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
/* #endif */
|
||||
@ -383,10 +418,6 @@
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.uni-noticebar__more-text {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
@keyframes notice {
|
||||
100% {
|
||||
transform: translate3d(-100%, 0, 0);
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-notice-bar",
|
||||
"displayName": "uni-notice-bar 通告栏",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.1",
|
||||
"description": "NoticeBar 通告栏组件,常用于展示公告信息,可设为滚动公告",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -17,11 +17,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -38,7 +34,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
|
@ -1,3 +1,10 @@
|
||||
## 1.2.4(2022-09-19)
|
||||
- 修复,未对主题色设置默认色,导致未引入 uni-scss 变量文件报错。
|
||||
- 修复,未对移动端当前页文字做主题色适配。
|
||||
## 1.2.3(2022-09-15)
|
||||
- 修复未使用 uni-scss 主题色的 bug。
|
||||
## 1.2.2(2022-07-06)
|
||||
- 修复 es 语言 i18n 错误
|
||||
## 1.2.1(2021-11-22)
|
||||
- 修复 vue3中某些scss变量无法找到的问题
|
||||
## 1.2.0(2021-11-19)
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"uni-pagination.prevText": "prev",
|
||||
"uni-pagination.nextText": "next"
|
||||
"uni-pagination.nextText": "next",
|
||||
"uni-pagination.piecePerPage": "piece/page"
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"uni-pagination.prevText": "anterior",
|
||||
"uni-pagination.nextText": "próxima"
|
||||
"uni-pagination.nextText": "prxima",
|
||||
"uni-pagination.piecePerPage": "Art¨ªculo/P¨¢gina"
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"uni-pagination.prevText": "précédente",
|
||||
"uni-pagination.nextText": "suivante"
|
||||
"uni-pagination.nextText": "suivante",
|
||||
"uni-pagination.piecePerPage": "Articles/Pages"
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"uni-pagination.prevText": "上一页",
|
||||
"uni-pagination.nextText": "下一页"
|
||||
"uni-pagination.nextText": "下一页",
|
||||
"uni-pagination.piecePerPage": "条/页"
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
{
|
||||
"uni-pagination.prevText": "上一頁",
|
||||
"uni-pagination.nextText": "下一頁"
|
||||
"uni-pagination.nextText": "下一頁",
|
||||
"uni-pagination.piecePerPage": "條/頁"
|
||||
}
|
||||
|
@ -1,5 +1,15 @@
|
||||
<template>
|
||||
<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 -->
|
||||
<view class="uni-pagination__total is-phone-hide">共 {{ total }} 条</view>
|
||||
<!-- #endif -->
|
||||
@ -16,8 +26,7 @@
|
||||
</view>
|
||||
<view class="uni-pagination__num uni-pagination__num-flex-none">
|
||||
<view class="uni-pagination__num-current">
|
||||
<text class="uni-pagination__num-current-text is-pc-hide"
|
||||
style="color:#409EFF">{{ currentIndex }}</text>
|
||||
<text class="uni-pagination__num-current-text is-pc-hide current-index-text">{{ currentIndex }}</text>
|
||||
<text class="uni-pagination__num-current-text is-pc-hide">/{{ maxPage || 0 }}</text>
|
||||
<!-- #ifndef APP-NVUE -->
|
||||
<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
|
||||
* @property {String} prevText 左侧按钮文字
|
||||
* @property {String} nextText 右侧按钮文字
|
||||
* @property {String} piecePerPageText 条/页文字
|
||||
* @property {Number} current 当前页
|
||||
* @property {Number} total 数据总量
|
||||
* @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} pageSizeChange 当前每页条数改变时触发 ,e={pageSize} pageSize 为当前所选的每页条数
|
||||
*/
|
||||
|
||||
import {
|
||||
@ -65,7 +78,7 @@
|
||||
} = initVueI18n(messages)
|
||||
export default {
|
||||
name: 'UniPagination',
|
||||
emits: ['update:modelValue', 'input', 'change'],
|
||||
emits: ['update:modelValue', 'input', 'change', 'pageSizeChange'],
|
||||
props: {
|
||||
value: {
|
||||
type: [Number, String],
|
||||
@ -81,6 +94,9 @@
|
||||
nextText: {
|
||||
type: String,
|
||||
},
|
||||
piecePerPageText: {
|
||||
type: String
|
||||
},
|
||||
current: {
|
||||
type: [Number, String],
|
||||
default: 1
|
||||
@ -100,18 +116,32 @@
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
showPageSize: {
|
||||
// 是否以 icon 形式展示按钮
|
||||
type: [Boolean, String],
|
||||
default: false
|
||||
},
|
||||
pagerCount: {
|
||||
type: Number,
|
||||
default: 7
|
||||
},
|
||||
pageSizeRange: {
|
||||
type: Array,
|
||||
default: () => [20, 50, 100, 500]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
pageSizeIndex: 0,
|
||||
currentIndex: 1,
|
||||
paperData: []
|
||||
paperData: [],
|
||||
pickerShow: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
piecePerPage() {
|
||||
return this.piecePerPageText || t('uni-pagination.piecePerPage')
|
||||
},
|
||||
prevPageText() {
|
||||
return this.prevText || t('uni-pagination.prevText')
|
||||
},
|
||||
@ -199,9 +229,31 @@
|
||||
this.currentIndex = val
|
||||
}
|
||||
}
|
||||
},
|
||||
pageSizeIndex(val) {
|
||||
this.$emit('pageSizeChange', this.pageSizeRange[val])
|
||||
}
|
||||
},
|
||||
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) {
|
||||
if (parseInt(e)) {
|
||||
@ -256,8 +308,8 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" >
|
||||
$uni-primary: #2979ff;
|
||||
<style lang="scss" scoped>
|
||||
$uni-primary: #2979ff !default;
|
||||
.uni-pagination {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
@ -352,6 +404,10 @@
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.current-index-text{
|
||||
color: $uni-primary;
|
||||
}
|
||||
|
||||
.uni-pagination--enabled {
|
||||
color: #333333;
|
||||
opacity: 1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"id": "uni-pagination",
|
||||
"displayName": "uni-pagination 分页器",
|
||||
"version": "1.2.1",
|
||||
"version": "1.2.4",
|
||||
"description": "Pagination 分页器组件,用于展示页码、请求数据等。",
|
||||
"keywords": [
|
||||
"uni-ui",
|
||||
@ -16,11 +16,7 @@
|
||||
"directories": {
|
||||
"example": "../../temps/example_temps"
|
||||
},
|
||||
"dcloudext": {
|
||||
"category": [
|
||||
"前端组件",
|
||||
"通用组件"
|
||||
],
|
||||
"dcloudext": {
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
@ -37,7 +33,8 @@
|
||||
"data": "无",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
|
||||
"type": "component-vue"
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": ["uni-scss","uni-icons"],
|
||||
|
@ -9,5 +9,3 @@
|
||||
|
||||
### [查看文档](https://uniapp.dcloud.io/component/uniui/uni-pagination)
|
||||
#### 如使用过程中有任何问题,或者您对uni-ui有一些好的建议,欢迎加入 uni-ui 交流群:871950839
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
<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">
|
||||
<uni-transition key="1" v-if="maskShow" name="mask" mode-class="fade" :styles="maskClass"
|
||||
:duration="duration" :show="showTrans" @click="onTap" />
|
||||
<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">
|
||||
<slot />
|
||||
</view>
|
||||
@ -86,6 +86,11 @@
|
||||
type: String,
|
||||
default: 'rgba(0, 0, 0, 0.4)'
|
||||
},
|
||||
// 指定使用v-show指令,不重新渲染Pop组件
|
||||
onceRender:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
|
@ -125,7 +125,7 @@ export default {
|
||||
} else {
|
||||
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.indeterminate = false
|
||||
this.trChildren.forEach((item, index) => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<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>
|
||||
|
||||
<script>
|
||||
@ -48,7 +48,11 @@ export default {
|
||||
customClass:{
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
onceRender:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user