Commit 24ad5a69 authored by 何远江's avatar 何远江

bug 修改,新增下拉框可输入组件

parent 6b636664
...@@ -164,10 +164,10 @@ export default { ...@@ -164,10 +164,10 @@ export default {
}); });
params.push({ params.push({
lfsnr: this.goodsList[0].workorderNo, lfsnr: this.goodsList[0].workorderNo,
BLDAT: 20240420, // BLDAT: 20240420,
BUDAT: 20240420, // BUDAT: 20240420,
// BLDAT: parseTime(new Date(),'{y}{m}{d}'), BLDAT: parseTime(new Date(),'{y}{m}{d}'),
// BUDAT: parseTime(new Date(),'{y}{m}{d}'), BUDAT: parseTime(new Date(),'{y}{m}{d}'),
item, item,
}) })
this.$u.api.sapApi this.$u.api.sapApi
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
宽(cm): 宽(cm):
</u-col> </u-col>
<u-col span="6"> <u-col span="6">
<uni-easyinput v-model="form.wide"></uni-easyinput> <uni-easyinput v-model="form.wide" @input="updateWeight"></uni-easyinput>
</u-col> </u-col>
</u-row> </u-row>
<u-row gutter="16" class="itemRow"> <u-row gutter="16" class="itemRow">
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
高(cm): 高(cm):
</u-col> </u-col>
<u-col span="6"> <u-col span="6">
<uni-easyinput v-model="form.high"></uni-easyinput> <uni-easyinput v-model="form.high" @input="updateWeight"></uni-easyinput>
</u-col> </u-col>
</u-row> </u-row>
<u-row gutter="16" class="itemRow"> <u-row gutter="16" class="itemRow">
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
箱重(kg): 箱重(kg):
</u-col> </u-col>
<u-col span="6"> <u-col span="6">
<uni-easyinput v-model="form.zxntgew"></uni-easyinput> <uni-easyinput v-model="form.zxntgew" @input="updateWeight"></uni-easyinput>
</u-col> </u-col>
</u-row> </u-row>
<u-row gutter="16" class="itemRow"> <u-row gutter="16" class="itemRow">
...@@ -99,17 +99,19 @@ export default { ...@@ -99,17 +99,19 @@ export default {
}, },
methods: { methods: {
updateWeight(e) { updateWeight(e) {
const reg = /^\d+\*\d+\*\d+\-\d+$/ console.log(e, '----')
const reg = /^\d+\*\d+\*\d+\-\d+(\.\d+)+$/
// 验证格式,判断是否是扫码 // 验证格式,判断是否是扫码
if (reg.test(e)) { if (reg.test(e)) {
console.log('扫码11111');
const arr = e.split('*') const arr = e.split('*')
this.$nextTick(() => { setTimeout(() => {
this.form.long = arr[0] this.form.long = arr[0]
this.form.wide = arr[1] this.form.wide = arr[1]
const data = arr[2].split('-') const data = arr[2].split('-')
this.form.high = data[0] this.form.high = data[0]
this.form.zxntgew = data[1] this.form.zxntgew = data[1]
}) }, 500)
} }
} }
} }
......
## 1.0.20(2024-05-09)
1.修复APP点击下拉框无法关闭
## 1.0.19(2024-04-29)
1.修复点击多个下拉框无法关闭
2.优化多选类型支持一次选择多个
3.修复小程序点击有个蓝色底
4.优化下拉菜单溢出屏幕底部时改为向上弹出
## 1.0.15(2023-11-24) ## 1.0.15(2023-11-24)
1.优化多选选中样式(tianheng20**qq.com网友提供) 1.优化多选选中样式(tianheng20**qq.com网友提供)
2.优化chang事件(chang事件中将返回所选中的对象) 2.优化chang事件(chang事件中将返回所选中的对象)
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
size="14" color="#999" /> size="14" color="#999" />
</view> </view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" /> <view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" v-if="showSelector"> <view class="uni-select__selector"
:class="isDown?'uni-select__selector__down':'uni-select__selector__upwards'" v-if="showSelector">
<view class="uni-popper__arrow"></view> <view class="uni-popper__arrow"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll"> <scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="filterMixinDatacomResData.length === 0"> <view class="uni-select__selector-empty" v-if="filterMixinDatacomResData.length === 0">
...@@ -63,7 +64,12 @@ ...@@ -63,7 +64,12 @@
* DataChecklist 数据选择器 * DataChecklist 数据选择器
* @description 通过数据渲染的下拉框组件 * @description 通过数据渲染的下拉框组件
* @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
* @property {String} value 默认值 * @property {String} collapseTagsNum 多选时选中值按文字的形式展示的数量
* @property {String} collapseTags 多选时是否将选中值按文字的形式展示
* @property {String} dataKey 作为 key 唯一标识的键名
* @property {String} dataValue 作为 value 唯一标识的键名
* @property {Array} multiple 是否多选
* @property {Array} filterable 是否开启搜索
* @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}] * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
* @property {Boolean} clear 是否可以清空已选项 * @property {Boolean} clear 是否可以清空已选项
* @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效 * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
...@@ -160,10 +166,13 @@ ...@@ -160,10 +166,13 @@
placeholderOld: "", placeholderOld: "",
currentArr: [], currentArr: [],
filterInput: "", filterInput: "",
isFocus: false isFocus: false,
windowHeight:0,
isDown:true,//下拉框是否朝下
}; };
}, },
created() { created() {
this.windowHeight=uni.getSystemInfoSync().windowHeight
if (this.multiple) { if (this.multiple) {
// #ifndef VUE3 // #ifndef VUE3
this.currentArr = this.value || [] this.currentArr = this.value || []
...@@ -281,6 +290,20 @@ ...@@ -281,6 +290,20 @@
}, },
}, },
methods: { methods: {
getIsDown(){
const query = uni.createSelectorQuery().in(this);
const _this=this
query
.select(".uni-stat-box")
.boundingClientRect((data) => {
if(_this.windowHeight-data.top>200){
_this.isDown=true
}else{
_this.isDown=false
}
})
.exec();
},
debounce(fn, time = 100) { debounce(fn, time = 100) {
let timer = null let timer = null
return function(...args) { return function(...args) {
...@@ -380,7 +403,6 @@ ...@@ -380,7 +403,6 @@
}, },
change(item) { change(item) {
if (!item.disable) { if (!item.disable) {
this.showSelector = false
if (this.multiple) { if (this.multiple) {
if (!this.current) { if (!this.current) {
this.current = [] this.current = []
...@@ -403,6 +425,7 @@ ...@@ -403,6 +425,7 @@
} }
this.filterInput = "" this.filterInput = ""
} else { } else {
this.showSelector = false
this.current = this.formatItemName(item) this.current = this.formatItemName(item)
if (this.filterable) { if (this.filterable) {
this.filterInput = item[this.dataKey] this.filterInput = item[this.dataKey]
...@@ -455,6 +478,7 @@ ...@@ -455,6 +478,7 @@
// } // }
// } // }
this.getIsDown()
this.showSelector = !this.showSelector this.showSelector = !this.showSelector
this.isFocus = this.showSelector this.isFocus = this.showSelector
if (this.filterable && this.current && this.showSelector) { if (this.filterable && this.current && this.showSelector) {
...@@ -548,7 +572,7 @@ ...@@ -548,7 +572,7 @@
display: flex; display: flex;
align-items: center; align-items: center;
// padding: 15px; // padding: 15px;
cursor: pointer; // cursor: pointer;
width: 100%; width: 100%;
flex: 1; flex: 1;
box-sizing: border-box; box-sizing: border-box;
...@@ -667,12 +691,30 @@ ...@@ -667,12 +691,30 @@
color: $uni-secondary-color; color: $uni-secondary-color;
} }
.uni-select__selector__down {
top: calc(100% + 12px);
.uni-popper__arrow {
transform: rotateX(0deg);
top: -6px;
}
}
.uni-select__selector__upwards {
bottom: calc(100% + 12px);
.uni-popper__arrow {
transform: rotateX(180deg);
bottom: -6px;
}
}
.uni-select__selector { .uni-select__selector {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
box-sizing: border-box; box-sizing: border-box;
/* #endif */ /* #endif */
position: absolute; position: absolute;
top: calc(100% + 12px);
left: 0; left: 0;
width: 100%; width: 100%;
background-color: #FFFFFF; background-color: #FFFFFF;
...@@ -694,7 +736,7 @@ ...@@ -694,7 +736,7 @@
.uni-select__selector-item { .uni-select__selector-item {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
cursor: pointer; // cursor: pointer;
/* #endif */ /* #endif */
line-height: 35px; line-height: 35px;
font-size: 14px; font-size: 14px;
...@@ -740,7 +782,7 @@ ...@@ -740,7 +782,7 @@
.uni-popper__arrow { .uni-popper__arrow {
filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03)); filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
top: -6px;
left: 10%; left: 10%;
margin-right: 3px; margin-right: 3px;
border-top-width: 0; border-top-width: 0;
...@@ -776,5 +818,6 @@ ...@@ -776,5 +818,6 @@
bottom: 0; bottom: 0;
right: 0; right: 0;
left: 0; left: 0;
z-index: 2;
} }
</style> </style>
\ No newline at end of file
{ {
"id": "zxz-uni-data-select", "id": "zxz-uni-data-select",
"displayName": "zxz-uni-data-select 下拉框选择器(添加下拉框检索,多选功能,多选搜索功能,自定义数据)", "displayName": "zxz-uni-data-select 下拉框选择器(添加下拉框检索,多选功能,多选搜索功能,自定义数据)",
"version": "1.0.15", "version": "1.0.20",
"description": "通过数据驱动的下拉框选择器(添加下拉框检索,多选功能,多选搜索功能,自定义数据)", "description": "通过数据驱动的下拉框选择器(添加下拉框检索,多选功能,多选搜索功能,自定义数据)",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"select", "select",
"uni-data-select", "uni-data-select",
"下拉框", "下拉框",
"下拉选" "下拉选择框"
], ],
"repository": "", "repository": "",
"engines": { "engines": {
...@@ -43,12 +43,13 @@ ...@@ -43,12 +43,13 @@
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y",
"alipay": "n"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "u", "app-vue": "y",
"app-nvue": "u" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
......
## DataSelect 下拉框选择器 先导入示例项目看看是否满足需求,然后再下载插件,有问题可以加微weiyila520 ## DataSelect 下拉框选择器 <strong style="color:orangered;"><em>先导入示例项目</em></strong> 看看是否满足需求,然后再下载插件,有问题可以加微<strong style="color:orangered;"><em>weiyila520</em></strong>
> **组件名:zxz-uni-data-select** > **组件名:zxz-uni-data-select**
> 代码块: `zxz-uni-data-select` > 代码块: `zxz-uni-data-select`
当选项过多时,使用下拉菜单展示并选择内容 本插件基于官方插件 [uni-data-select](https://ext.dcloud.net.cn/plugin?id=7993) 进行二次开发拓展功能,支持uni-data-select本身功能不变(表单验证等)
## API
<h1>拓展功能</h1>
<ol>
<li>支持多选功能</li>
<li>支持选项禁用</li>
<li>支持自定义显示值</li>
<li>支持搜索</li>
<li>支持多选时将选中值按文字形式展示</li>
<li>支持下拉菜单溢出屏幕底部时自动改为向上弹出</li>
<li>监听搜索输入事件</li>
</ol>
<h2>API</h2>
### zxz-uni-data-select Props ### zxz-uni-data-select Props
| 属性名 | 类型 | 默认值 | 说明 | | 属性名 | 类型 | 默认值 | 说明 |
...@@ -14,14 +25,13 @@ ...@@ -14,14 +25,13 @@
| disabled | Boolean |false | 是否禁用 | | disabled | Boolean |false | 是否禁用 |
| dataKey | String |"key" | 作为 key 唯一标识的键名 | | dataKey | String |"key" | 作为 key 唯一标识的键名 |
| dataValue | String | "value" | 作为 value 唯一标识的键名 | | dataValue | String | "value" | 作为 value 唯一标识的键名 |
| collapseTags | Boolean | false | 多选时是否将选中值按文字的形式展示| | filterable | Boolean | false | 是否开启搜索 |
|collapseTagsNum|Number | 1 | 多选时选中值按文字的形式展示的数量| | collapseTags | Boolean | false | 多选时是否将选中值按文字的形式展示 |
|collapseTagsNum|Number | 1 | 多选时选中值按文字的形式展示的数量 |
| localdata | Array |- | 下拉列表本地数据 | | localdata | Array |- | 下拉列表本地数据 |
|label | String | - | 左侧标题 |label | String | - | 左侧标题 |
|placeholder | String | "请选择" | 输入框的提示文字 |placeholder | String | "请选择" | 输入框的提示文字 |
|emptyTips | String |"无选项" | 无选项提示 |emptyTips | String |"无选项" | 无选项提示 |
|clear | Boolean | true| 是否清空 |clear | Boolean | true | 是否清空 |
|format | String | - | 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}" |format | String | - | 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"|
|@inputChange | event | event(String) | 搜索输入事件 |
#### 如使用过程中有任何问题,或者您对组件有一些好的建议 \ No newline at end of file
## 欢迎加微weiyila520
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment