uni-app select All In One
uni-app select All In One
https://uniapp.dcloud.io/component/picker
https://hellouniapp.dcloud.net.cn/pages/component/picker/picker
技术选型
https://github.com/dcloudio/uni-app/blob/master/docs/select.md
https://uniapp.dcloud.io/select
picker
https://uniapp.dcloud.io/component/picker
https://ask.dcloud.net.cn/article/36083
select
https://ext.dcloud.net.cn/plugin?id=518
https://ask.dcloud.net.cn/question/69929
https://github.com/xiafl/hx_uniapp_compontent__xfl-select
<template>
<div class="show-box" :class="{disabled: disabled, active: isShowList}" :style="style_Container">
<!-- 输入框,仅在可输入模式下使用 -->
<input
v-if="showInput" class="input" placeholder-style="color: #bbb;"
type="text" v-model="selectText" :placeholder="placeholder"
@focus="onFocus" @blur="onBlur" @input="onInput" @confirm="$emit('confirm', $event)"
>
<!-- 显示框 -->
<div v-else class="input" :class="{placeholder: selectText === placeholder}" @click="onUpperClick" >{{selectText}}</div>
<!-- 右侧的小三角图标 -->
<span
@click="onUpperClick"
class="iconfont iconarrowBottom-fill right-arrow"
:class="{isRotate: isRotate}"
></span>
<!-- 清除按钮图标 -->
<span
v-if="clearable && selectText && selectText != placeholder"
class="right-arrow" @click="onClear"
>
<span class="iconfont iconshanchu1 clear"></span>
</span>
<!-- 列表框 -->
<div class="list-container"
@click.stop="onListClick"
:style="'top:' + listTop__ + 'px;'" v-show="isShowList">
<span class="popper__arrow"></span> <!-- 列表框左上角的空心小三角 -->
<scroll-view
class="list" style="background-color: #fff;"
:style="'max-height: ' + listBoxHeight__ +'em;'"
scroll-y=true scroll-x=true
>
<div
class="item" @click="onClickItem(index, item.value)"
v-for="(item, index) in innerList" :key="index"
:class="{active: activeIndex == index, disabled: item.disabled}"
>
<div>{{item.value}}</div>
</div>
<div v-show="innerList.length==0" class="data-state item">无数据</div>
<!-- <slot></slot> -->
</scroll-view>
</div>
</div>
</template>
css fonts & base64
data:application/x-font-woff2;charset=utf-8;base64,
//************************************** 以下为字体 ****************************************
@font-face {font-family: "iconfont";
src:
url('data:application/x-font-woff2;charset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fOg9iHUvl4xmjRJjBjBI4IC7NAxZVgBi87Ae0liqHZGIKhluZKD6dH2j+8Jd0AY9MUcVKXLU5I9a6XU7FUcUppMkCss5MAeXmM7a3Q4A') format('woff')
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.iconshanchu1:before {
content: "\e68c";
}
.icongou:before {
content: "\e786";
}
.iconarrowBottom-fill:before {
content: "\e60e";
}
refs
©xgqfrms 2012-2020
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/15037707.html
未经授权禁止转载,违者必究!