Skip to content

Commit

Permalink
update: uni-data-select
Browse files Browse the repository at this point in the history
  • Loading branch information
Fasttian committed Jun 1, 2022
1 parent a1a80f3 commit fedb363
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 43 deletions.
4 changes: 4 additions & 0 deletions uni_modules/uni-data-select/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.3(2022-06-02)
- 修复 localdata 赋值不生效的 bug
- 新增 支持 uni.scss 修改颜色
- 新增 支持选项禁用(数据选项设置 disabled: true 即禁用)
## 0.1.2(2022-05-08)
- 修复 当 value 为 0 时选择不生效的 bug
## 0.1.1(2022-05-07)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
<template>
<view class="uni-stat__select">
<span v-if="label" class="uni-label-text hide-on-phone">{{label + ':'}}</span>
<view :class="{'uni-stat__actived': current}">
<view class="uni-select">
<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>
<uni-icons v-if="current && clear" type="clear" color="#e1e1e1" size="18" @click="clearVal" />
<uni-icons v-else :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" v-if="showSelector">
<view class="uni-popper__arrow"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
</view>
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData"
:key="index" @click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
</scroll-view>
</view>
<view class="uni-select">
<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>
<uni-icons v-if="current && clear" type="clear" color="#e1e1e1" size="18" @click="clearVal" />
<uni-icons v-else :type="showSelector? 'top' : 'bottom'" size="14" color="#999" />
</view>
<view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
<view class="uni-select__selector" v-if="showSelector">
<view class="uni-popper__arrow"></view>
<scroll-view scroll-y="true" class="uni-select__selector-scroll">
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
</view>
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData"
:key="index" @click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
</scroll-view>
</view>
</view>
</view>
Expand Down Expand Up @@ -113,7 +111,7 @@
localdata: {
immediate: true,
handler(val, old) {
if (Array.isArray(val) && !old) {
if (Array.isArray(val)) {
this.mixinDatacomResData = val
}
}
Expand Down Expand Up @@ -224,7 +222,13 @@
}
</script>

<style>
<style lang="scss">
$uni-base-color: #6a6a6a !default;
$uni-main-color: #3a3a3a !default;
$uni-secondary-color: #909399 !default;
$uni-border-3: #DCDCDC;
/* #ifndef APP-NVUE */
@media screen and (max-width: 500px) {
.hide-on-phone {
Expand All @@ -240,21 +244,17 @@
cursor: pointer;
}
.uni-stat__actived {
outline: 1px solid #2979ff;
}
.uni-label-text {
font-size: 14px;
font-weight: bold;
color: #555;
color: $uni-base-color;
margin: auto 0;
margin-right: 5px;
}
.uni-select {
font-size: 14px;
border: 1px solid #DCDFE6;
border: 1px solid $uni-border-3;
box-sizing: border-box;
border-radius: 4px;
padding: 0 5px;
Expand All @@ -265,14 +265,14 @@
/* #endif */
flex-direction: row;
align-items: center;
border-bottom: solid 1px #DDDDDD;
border-bottom: solid 1px $uni-border-3;
}
.uni-select__label {
font-size: 16px;
line-height: 22px;
padding-right: 10px;
color: #999999;
color: $uni-secondary-color;
}
.uni-select__input-box {
Expand All @@ -295,7 +295,7 @@
.uni-select__input-plac {
font-size: 14px;
color: #999;
color: $uni-secondary-color;
}
.uni-select__selector {
Expand Down Expand Up @@ -330,7 +330,7 @@
line-height: 36px;
font-size: 14px;
text-align: center;
/* border-bottom: solid 1px #DDDDDD; */
/* border-bottom: solid 1px $uni-border-3; */
padding: 0px 10px;
}
Expand Down Expand Up @@ -381,15 +381,15 @@
.uni-select__input-text {
width: 280px;
color: #333;
color: $uni-main-color;
white-space: nowrap;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
overflow: hidden;
}
.uni-select__input-placeholder {
color: #666;
color: $uni-base-color;
}
.uni-select--mask {
Expand Down
16 changes: 8 additions & 8 deletions uni_modules/uni-data-select/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "0.1.2",
"version": "0.1.3",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
Expand Down Expand Up @@ -51,7 +51,7 @@
"client": {
"App": {
"app-vue": "u",
"app-nvue": "y"
"app-nvue": "n"
},
"H5-mobile": {
"Safari": "y",
Expand All @@ -68,15 +68,15 @@
},
"小程序": {
"微信": "y",
"阿里": "y",
"百度": "y",
"字节跳动": "y",
"QQ": "y",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"京东": "u"
},
"快应用": {
"华为": "y",
"联盟": "y"
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
Expand Down

0 comments on commit fedb363

Please sign in to comment.