zxz-uni-data-select.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852
  1. <template>
  2. <view class="uni-stat__select">
  3. <!-- hide-on-phone -->
  4. <span v-if="label" class="uni-label-text">{{label + ':'}}</span>
  5. <view class="uni-stat-box" :class="{'uni-stat__actived': current}">
  6. <view class="uni-select" :style="{height:multiple?'100%':' 35px'}"
  7. :class="{'uni-select--disabled':disabled}">
  8. <view class="uni-select__input-box" :style="{height:multiple?'100%':'35px'}" @click="toggleSelector">
  9. <view class="" style="display: flex;flex-wrap: wrap;width: 100%;" v-if="multiple&&current.length>0">
  10. <!-- 2025.7.25 新增 如果选项中存在全部角色选项 则只显示全部角色,其他角色隐藏 -->
  11. <view :class="['tag-calss',{'hide':isHaveAll && item[dataValue]!='all'}]"
  12. v-for="(item,index) in collapseTags?current.slice(0,collapseTagsNum):current"
  13. :key="item[dataValue]">
  14. <span class="text">{{item[dataKey]}}</span>
  15. <view class="clear_btn" @click.stop="delItem(item)">
  16. <uni-icons type="clear" style="margin-left: 4px;" color="#c0c4cc" />
  17. </view>
  18. </view>
  19. <view v-if="current.length>collapseTagsNum&&collapseTags" class="tag-calss">
  20. <span class="text">+{{current.length-collapseTagsNum}}</span>
  21. </view>
  22. <input v-if="filterable&&!disabled" @input="inputChange" class="uni-select__input-text"
  23. type="text" style="font-size: 12px;height: 52rpx;margin-left: 6px;width: auto;flex:1;"
  24. placeholder="请输入" v-model="filterInput">
  25. </view>
  26. <view v-else-if="current&&current.length>0&&!showSelector" class="uni-select__input-text">
  27. {{current}}
  28. </view>
  29. <input v-else-if="filterable&&showSelector" :focus="isFocus" @input="inputChange"
  30. :disabled="disabled" @click.stop="" class="uni-select__input-text" type="text"
  31. style="font-size: 12px;position: absolute;z-index: 1;" :placeholder="placeholderOld"
  32. v-model="filterInput">
  33. <view v-else class="uni-select__input-text uni-select__input-placeholder">{{typePlaceholder}}</view>
  34. <uni-icons v-if="(current.length>0 && clear&&!disabled)||(currentArr.length>0&&clear&&!disabled)"
  35. type="clear" color="#c0c4cc" size="24" style="position: absolute;right: 0;" @click="clearVal" />
  36. <uni-icons style="right: 0;position: absolute;" v-else :type="showSelector? 'top' : 'bottom'"
  37. size="14" color="#999" />
  38. </view>
  39. <view class="uni-select--mask" v-if="showSelector" @click="toggleSelector" />
  40. <view class="uni-select__selector"
  41. :class="isDown?'uni-select__selector__down':'uni-select__selector__upwards'" v-if="showSelector">
  42. <view class="uni-popper__arrow"></view>
  43. <scroll-view scroll-y="true" class="uni-select__selector-scroll">
  44. <view class="uni-select__selector-empty" v-if="filterMixinDatacomResData.length === 0">
  45. <span>{{emptyTips}}</span>
  46. </view>
  47. <view v-else :class="['uni-select__selector-item', {'uni-select_selector-item_active' :multiple
  48. && currentArr.includes(item[dataValue])}]"
  49. style="display: flex;justify-content: space-between;align-items: center;"
  50. v-for="(item,index) in filterMixinDatacomResData" :key="index" @click="change(item)">
  51. <span :class="['uni-select__selector_text',{'uni-select__selector__disabled': item.disable}]">{{formatItemName(item)}}</span>
  52. <uni-icons v-if="multiple&&currentArr.includes(item[dataValue])" type="checkmarkempty"
  53. color="#2E64FA" style="font-size: 28rpx;" />
  54. </view>
  55. </scroll-view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  63. /**
  64. * DataChecklist 数据选择器
  65. * @description 通过数据渲染的下拉框组件
  66. * @tutorial https://uniapp.dcloud.io/component/uniui/uni-data-select
  67. * @property {String} collapseTagsNum 多选时选中值按文字的形式展示的数量
  68. * @property {String} collapseTags 多选时是否将选中值按文字的形式展示
  69. * @property {String} dataKey 作为 key 唯一标识的键名
  70. * @property {String} dataValue 作为 value 唯一标识的键名
  71. * @property {Array} multiple 是否多选
  72. * @property {Array} filterable 是否开启搜索
  73. * @property {Array} localdata 本地数据 ,格式 [{text:'',value:''}]
  74. * @property {Boolean} clear 是否可以清空已选项
  75. * @property {Boolean} emptyText 没有数据时显示的文字 ,本地数据无效
  76. * @property {String} label 左侧标题
  77. * @property {String} placeholder 输入框的提示文字
  78. * @property {Boolean} disabled 是否禁用
  79. * @event {Function} change 选中发生变化触发
  80. */
  81. export default {
  82. name: "uni-stat-select",
  83. mixins: [uniCloud.mixinDatacom || {}],
  84. components:{
  85. uniIcons
  86. },
  87. props: {
  88. collapseTagsNum: {
  89. type: Number,
  90. default: 1
  91. },
  92. collapseTags: {
  93. type: Boolean,
  94. default: false
  95. },
  96. dataKey: {
  97. type: [String],
  98. default: 'text'
  99. },
  100. dataValue: {
  101. type: [String],
  102. default: 'value'
  103. },
  104. multiple: {
  105. type: Boolean,
  106. default: false
  107. },
  108. filterable: {
  109. type: Boolean,
  110. default: false
  111. },
  112. localdata: {
  113. type: Array,
  114. default () {
  115. return []
  116. }
  117. },
  118. // #ifndef VUE3
  119. value: {
  120. type: [String, Number, Array],
  121. default: ''
  122. },
  123. // #endif
  124. // #ifdef VUE3
  125. modelValue: {
  126. type: [String, Number, Array],
  127. default: ''
  128. },
  129. // #endif
  130. label: {
  131. type: String,
  132. default: ''
  133. },
  134. placeholder: {
  135. type: String,
  136. default: '请选择'
  137. },
  138. emptyTips: {
  139. type: String,
  140. default: '无选项'
  141. },
  142. clear: {
  143. type: Boolean,
  144. default: true
  145. },
  146. defItem: {
  147. type: Number,
  148. default: 0
  149. },
  150. disabled: {
  151. type: Boolean,
  152. default: false
  153. },
  154. // 格式化输出 用法 field="_id as value, version as text, uni_platform as label" format="{label} - {text}"
  155. format: {
  156. type: String,
  157. default: ''
  158. },
  159. },
  160. data() {
  161. return {
  162. showSelector: false,
  163. current: [],
  164. mixinDatacomResData: [],
  165. apps: [],
  166. channels: [],
  167. cacheKey: "uni-data-select-lastSelectedValue",
  168. placeholderOld: "",
  169. currentArr: [],
  170. filterInput: "",
  171. isFocus: false,
  172. windowHeight:0,
  173. isDown:true,//下拉框是否朝下
  174. isHaveAll:false,//2025.7.25 新增 是否有全部角色选项,有则隐藏其他选项
  175. };
  176. },
  177. created() {
  178. this.windowHeight=uni.getSystemInfoSync().windowHeight
  179. if (this.multiple) {
  180. // #ifndef VUE3
  181. this.currentArr = this.value || []
  182. // #endif
  183. // #ifdef VUE3
  184. this.currentArr = this.modelValue || []
  185. // #endif
  186. if (this.current.length > 0) {
  187. this.current = []
  188. }
  189. // #ifndef VUE3
  190. if (this.value && this.value.length > 0 && this.filterMixinDatacomResData.length > 0) {
  191. this.current = this.value.map(item => {
  192. let current = this.mixinDatacomResData.find(e =>
  193. e[this.dataValue] == item
  194. )
  195. return {
  196. ...current
  197. }
  198. })
  199. }
  200. // #endif
  201. // #ifdef VUE3
  202. if (this.modelValue && this.modelValue.length > 0 && this.filterMixinDatacomResData.length > 0) {
  203. this.current = this.modelValue.map(item => {
  204. let current = this.mixinDatacomResData.find(e =>
  205. e[this.dataValue] == item
  206. )
  207. return {
  208. ...current
  209. }
  210. })
  211. }
  212. // #endif
  213. } else {
  214. // #ifndef VUE3
  215. if (this.value || this.value == 0) {
  216. this.current = this.formatItemName(this.filterMixinDatacomResData.find(e =>
  217. e[this.dataValue] == this.value
  218. ))
  219. }
  220. // #endif
  221. // #ifdef VUE3
  222. if (this.modelValue || this.value == 0) {
  223. this.current = this.formatItemName(this.filterMixinDatacomResData.find(e =>
  224. e[this.dataValue] == this.modelValue
  225. ))
  226. }
  227. // #endif
  228. }
  229. this.placeholderOld = this.placeholder
  230. this.debounceGet = this.debounce(() => {
  231. this.query();
  232. }, 300);
  233. if (this.collection && !this.localdata.length) {
  234. this.debounceGet();
  235. }
  236. },
  237. computed: {
  238. filterMixinDatacomResData() {
  239. if (this.filterable && this.filterInput) {
  240. return this.mixinDatacomResData.filter(e => e[this.dataKey].includes(this.filterInput))
  241. } else {
  242. return this.mixinDatacomResData
  243. }
  244. },
  245. typePlaceholder() {
  246. const text = {
  247. 'opendb-stat-app-versions': '版本',
  248. 'opendb-app-channels': '渠道',
  249. 'opendb-app-list': '应用'
  250. }
  251. const common = this.placeholder
  252. const placeholder = text[this.collection]
  253. return placeholder ?
  254. common + placeholder :
  255. common
  256. },
  257. valueCom() {
  258. // #ifdef VUE3
  259. return this.modelValue;
  260. // #endif
  261. // #ifndef VUE3
  262. return this.value;
  263. // #endif
  264. }
  265. },
  266. watch: {
  267. localdata: {
  268. immediate: true,
  269. handler(val, old) {
  270. if (Array.isArray(val) && old !== val) {
  271. this.mixinDatacomResData = val || []
  272. }
  273. }
  274. },
  275. valueCom: {
  276. handler(newVal, oldVal) {
  277. // console.log(newVal, oldVal);
  278. this.initDefVal()
  279. },
  280. deep: true,
  281. immediate: true
  282. },
  283. mixinDatacomResData: {
  284. immediate: true,
  285. handler(val) {
  286. if (val.length) {
  287. this.initDefVal()
  288. }
  289. }
  290. },
  291. modelValue: {//2025.7.25 新增 是否有全部角色选项,有则隐藏其他选项
  292. immediate: true,
  293. handler(val, old) {
  294. this.isHaveAll = val.indexOf('all') > -1;
  295. }
  296. },
  297. },
  298. methods: {
  299. getIsDown(){
  300. const query = uni.createSelectorQuery().in(this);
  301. const _this=this
  302. query
  303. .select(".uni-stat-box")
  304. .boundingClientRect((data) => {
  305. if(_this.windowHeight-data.top>200){
  306. _this.isDown=true
  307. }else{
  308. _this.isDown=false
  309. }
  310. })
  311. .exec();
  312. },
  313. debounce(fn, time = 100) {
  314. let timer = null
  315. return function(...args) {
  316. if (timer) clearTimeout(timer)
  317. timer = setTimeout(() => {
  318. fn.apply(this, args)
  319. }, time)
  320. }
  321. },
  322. // 执行数据库查询
  323. query() {
  324. this.mixinDatacomEasyGet();
  325. },
  326. // 监听查询条件变更事件
  327. onMixinDatacomPropsChange() {
  328. if (this.collection) {
  329. this.debounceGet();
  330. }
  331. },
  332. initDefVal() {
  333. let defValue = ''
  334. if ((this.valueCom || this.valueCom === 0) && !this.isDisabled(this.valueCom)) {
  335. defValue = this.valueCom
  336. } else {
  337. let strogeValue
  338. if (this.collection) {
  339. strogeValue = this.getCache()
  340. }
  341. if (strogeValue || strogeValue === 0) {
  342. defValue = strogeValue
  343. } else {
  344. let defItem = ''
  345. if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
  346. defItem = this.mixinDatacomResData[this.defItem - 1][this.dataValue]
  347. }
  348. defValue = defItem
  349. }
  350. if (defValue || defValue === 0) {
  351. this.emit(defValue)
  352. }
  353. }
  354. if (this.multiple) {
  355. const mixinDatacomResData = this.mixinDatacomResData || []
  356. if (!defValue) defValue = []
  357. this.current = defValue.map(item => {
  358. const current = mixinDatacomResData.find(e => {
  359. return e[this.dataValue] == item
  360. })
  361. return {
  362. ...current
  363. }
  364. })
  365. this.currentArr = this.current.map(e => e[this.dataValue])
  366. if (defValue.length < 1) {
  367. this.currentArr = []
  368. }
  369. } else {
  370. const def = this.mixinDatacomResData.find(item => item[this.dataValue] === defValue)
  371. this.current = def ? this.formatItemName(def) : ''
  372. }
  373. },
  374. /**
  375. * @param {[String, Number]} value
  376. * 判断用户给的 value 是否同时为禁用状态
  377. */
  378. isDisabled(value) {
  379. let isDisabled = false;
  380. this.mixinDatacomResData.forEach(item => {
  381. if (item[this.dataValue] === value) {
  382. isDisabled = item.disable
  383. }
  384. })
  385. return isDisabled;
  386. },
  387. inputChange(e) {
  388. this.$emit('inputChange', e.detail.value)
  389. },
  390. clearVal() {
  391. if (this.disabled) {
  392. return
  393. }
  394. if (this.multiple) {
  395. this.current = []
  396. this.currentArr = []
  397. this.emit([])
  398. } else {
  399. this.current = ""
  400. this.currentArr = []
  401. this.emit('')
  402. }
  403. if (this.collection) {
  404. this.removeCache()
  405. }
  406. this.placeholderOld = this.placeholder
  407. this.filterInput = ""
  408. },
  409. change(item) {
  410. if (!item.disable) {
  411. if (this.multiple) {
  412. if (!this.current) {
  413. this.current = []
  414. }
  415. if (!this.currentArr) {
  416. this.currentArr = []
  417. }
  418. if (this.currentArr.includes(item[this.dataValue])) {
  419. let index = this.current.findIndex(e => {
  420. return e[this.dataValue] == item[this.dataValue]
  421. })
  422. this.current.splice(index, 1)
  423. this.currentArr.splice(index, 1)
  424. this.emit(this.current)
  425. } else {
  426. this.current.push(item)
  427. this.currentArr.push(item[this.dataValue])
  428. this.emit(this.current)
  429. }
  430. this.filterInput = ""
  431. } else {
  432. this.showSelector = false
  433. this.current = this.formatItemName(item)
  434. if (this.filterable) {
  435. this.filterInput = item[this.dataKey]
  436. }
  437. this.emit(item[this.dataValue])
  438. }
  439. }
  440. },
  441. delItem(item) {
  442. if (this.disabled) {
  443. return
  444. }
  445. if (this.currentArr.includes(item[this.dataValue])) {
  446. let index = this.current.findIndex(e => {
  447. return e[this.dataValue] == item[this.dataValue]
  448. })
  449. this.current.splice(index, 1)
  450. this.currentArr.splice(index, 1)
  451. this.emit(this.current)
  452. }
  453. },
  454. emit(val) {
  455. if (this.multiple) {
  456. this.$emit('input', this.currentArr)
  457. this.$emit('update:modelValue', this.currentArr)
  458. const currentArr = this.mixinDatacomResData.filter(item => this.currentArr.includes(item[this
  459. .dataValue]))
  460. this.$emit('change', currentArr)
  461. } else {
  462. this.$emit('input', val)
  463. this.$emit('update:modelValue', val)
  464. const current = this.mixinDatacomResData.find(item => val == item[this.dataValue])
  465. console.log(current);
  466. this.$emit('change', current)
  467. }
  468. if (this.collection) {
  469. this.setCache(val);
  470. }
  471. },
  472. toggleSelector() {
  473. if (this.disabled) {
  474. return
  475. }
  476. // if (this.filterable && this.filterInput && this.mixinDatacomResData.findIndex(e => {
  477. // return e[this.dataKey] == this
  478. // .filterInput
  479. // }) < 0) {
  480. // if (!this.multiple) {
  481. // this.filterInput = ""
  482. // }
  483. // }
  484. this.getIsDown()
  485. this.showSelector = !this.showSelector
  486. this.isFocus = this.showSelector
  487. if (this.filterable && this.current && this.showSelector) {
  488. if (!this.multiple) {
  489. this.placeholderOld = this.current
  490. // this.filterInput = ""
  491. }
  492. } else if (this.filterable && !this.current && !this.showSelector) {
  493. if (this.placeholderOld != this.placeholder) {
  494. if (!this.multiple) {
  495. this.current = this.placeholderOld
  496. }
  497. }
  498. }
  499. this.filterInput = ""
  500. },
  501. formatItemName(item) {
  502. if (!item) {
  503. return ""
  504. }
  505. let text = item[this.dataKey]
  506. let value = item[this.dataValue]
  507. let {
  508. channel_code
  509. } = item
  510. channel_code = channel_code ? `(${channel_code})` : ''
  511. if (this.format) {
  512. // 格式化输出
  513. let str = "";
  514. str = this.format;
  515. for (let key in item) {
  516. str = str.replace(new RegExp(`{${key}}`, "g"), item[key]);
  517. }
  518. return str;
  519. } else {
  520. return this.collection.indexOf('app-list') > 0 ?
  521. `${text}(${value})` :
  522. (
  523. text ?
  524. text :
  525. `未命名${channel_code}`
  526. )
  527. }
  528. },
  529. // 获取当前加载的数据
  530. getLoadData() {
  531. return this.mixinDatacomResData;
  532. },
  533. // 获取当前缓存key
  534. getCurrentCacheKey() {
  535. return this.collection;
  536. },
  537. // 获取缓存
  538. getCache(name = this.getCurrentCacheKey()) {
  539. let cacheData = uni.getStorageSync(this.cacheKey) || {};
  540. return cacheData[name];
  541. },
  542. // 设置缓存
  543. setCache(value, name = this.getCurrentCacheKey()) {
  544. let cacheData = uni.getStorageSync(this.cacheKey) || {};
  545. cacheData[name] = value;
  546. uni.setStorageSync(this.cacheKey, cacheData);
  547. },
  548. // 删除缓存
  549. removeCache(name = this.getCurrentCacheKey()) {
  550. let cacheData = uni.getStorageSync(this.cacheKey) || {};
  551. delete cacheData[name];
  552. uni.setStorageSync(this.cacheKey, cacheData);
  553. },
  554. }
  555. }
  556. </script>
  557. <style lang="scss">
  558. $uni-base-color: #6a6a6a !default;
  559. $uni-main-color: #333 !default;
  560. $uni-secondary-color: #909399 !default;
  561. $uni-border-3: #e5e5e5;
  562. /* #ifndef APP-NVUE */
  563. @media screen and (max-width: 500px) {
  564. .hide-on-phone {
  565. display: none;
  566. }
  567. }
  568. /* #endif */
  569. .uni-stat__select {
  570. display: flex;
  571. align-items: center;
  572. // padding: 15px;
  573. // cursor: pointer;
  574. width: 100%;
  575. flex: 1;
  576. box-sizing: border-box;
  577. }
  578. .uni-stat-box {
  579. width: 100%;
  580. flex: 1;
  581. }
  582. .uni-stat__actived {
  583. width: 100%;
  584. flex: 1;
  585. // outline: 1px solid #2979ff;
  586. }
  587. .uni-label-text {
  588. font-size: 14px;
  589. font-weight: bold;
  590. color: $uni-base-color;
  591. margin: auto 0;
  592. margin-right: 5px;
  593. }
  594. .uni-select {
  595. font-size: 14px;
  596. border: 1px solid $uni-border-3;
  597. box-sizing: border-box;
  598. border-radius: 4px;
  599. padding: 0 5px;
  600. padding-left: 10px;
  601. position: relative;
  602. /* #ifndef APP-NVUE */
  603. display: flex;
  604. user-select: none;
  605. /* #endif */
  606. flex-direction: row;
  607. align-items: center;
  608. border-bottom: solid 1px $uni-border-3;
  609. width: 100%;
  610. flex: 1;
  611. height: 35px;
  612. min-height: 35px;
  613. &--disabled {
  614. background-color: #f5f7fa;
  615. cursor: not-allowed;
  616. }
  617. }
  618. .uni-select__label {
  619. font-size: 16px;
  620. // line-height: 22px;
  621. min-height: 35px;
  622. height: 35px;
  623. padding-right: 10px;
  624. color: $uni-secondary-color;
  625. }
  626. .uni-select__input-box {
  627. width: 100%;
  628. height: 35px;
  629. position: relative;
  630. /* #ifndef APP-NVUE */
  631. display: flex;
  632. /* #endif */
  633. flex: 1;
  634. flex-direction: row;
  635. align-items: center;
  636. .tag-calss {
  637. font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
  638. font-weight: 400;
  639. -webkit-font-smoothing: antialiased;
  640. -webkit-tap-highlight-color: transparent;
  641. font-size: 12px;
  642. border: 1px solid #d9ecff;
  643. border-radius: 4px;
  644. white-space: nowrap;
  645. height: 24px;
  646. padding: 0 2px 0px 4px;
  647. line-height: 22px;
  648. box-sizing: border-box;
  649. margin: 2px 6px 2px 0;
  650. display: flex;
  651. max-width: 100%;
  652. align-items: center;
  653. background-color: #f4f4f5;
  654. border-color: #e9e9eb;
  655. color: #909399;
  656. &.hide{
  657. // 2025.7.25 新增 如果选项中存在全部角色选项 则只显示全部角色,其他角色隐藏
  658. display: none;
  659. }
  660. .text {
  661. font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, SimSun, sans-serif;
  662. font-weight: 400;
  663. -webkit-font-smoothing: antialiased;
  664. -webkit-tap-highlight-color: transparent;
  665. font-size: 12px;
  666. white-space: nowrap;
  667. line-height: 22px;
  668. color: #909399;
  669. overflow: hidden;
  670. text-overflow: ellipsis;
  671. }
  672. .clear_btn{
  673. display: inline-flex;
  674. }
  675. }
  676. }
  677. .uni-select__input {
  678. flex: 1;
  679. font-size: 14px;
  680. height: 22px;
  681. line-height: 22px;
  682. }
  683. .uni-select__input-plac {
  684. font-size: 14px;
  685. color: $uni-secondary-color;
  686. }
  687. .uni-select__selector__down {
  688. top: calc(100% + 12px);
  689. .uni-popper__arrow {
  690. transform: rotateX(0deg);
  691. top: -6px;
  692. }
  693. }
  694. .uni-select__selector__upwards {
  695. bottom: calc(100% + 12px);
  696. .uni-popper__arrow {
  697. transform: rotateX(180deg);
  698. bottom: -6px;
  699. }
  700. }
  701. .uni-select__selector {
  702. /* #ifndef APP-NVUE */
  703. box-sizing: border-box;
  704. /* #endif */
  705. position: absolute;
  706. left: 0;
  707. width: 100%;
  708. background-color: #FFFFFF;
  709. border: 1px solid #EBEEF5;
  710. border-radius: 6px;
  711. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  712. z-index: 3;
  713. padding: 4px 0;
  714. }
  715. .uni-select__selector-scroll {
  716. /* #ifndef APP-NVUE */
  717. max-height: 200px;
  718. box-sizing: border-box;
  719. /* #endif */
  720. }
  721. .uni-select__selector-empty,
  722. .uni-select__selector-item {
  723. /* #ifndef APP-NVUE */
  724. display: flex;
  725. // cursor: pointer;
  726. /* #endif */
  727. line-height: 35px;
  728. font-size: 14px;
  729. text-align: center;
  730. /* border-bottom: solid 1px $uni-border-3; */
  731. padding: 0px 10px;
  732. }
  733. .uni-select__selector-item{
  734. justify-content: space-between;
  735. align-items: center;
  736. }
  737. .uni-select__selector_text{
  738. flex:1;
  739. white-space: nowrap;
  740. overflow: hidden;
  741. text-overflow: ellipsis;
  742. text-align: left;
  743. }
  744. .uni-select__selector-item:hover {
  745. background-color: #f9f9f9;
  746. }
  747. .uni-select__selector-empty:last-child,
  748. .uni-select__selector-item:last-child {
  749. /* #ifndef APP-NVUE */
  750. border-bottom: none;
  751. /* #endif */
  752. }
  753. .uni-select_selector-item_active {
  754. color: #409eff;
  755. // font-weight: bold;
  756. background-color: #f5f7fa;
  757. border-radius: 3px;
  758. }
  759. .uni-select__selector__disabled {
  760. opacity: 0.4;
  761. cursor: default;
  762. }
  763. /* picker 弹出层通用的指示小三角 */
  764. .uni-popper__arrow,
  765. .uni-popper__arrow::after {
  766. position: absolute;
  767. display: block;
  768. width: 0;
  769. height: 0;
  770. border-color: transparent;
  771. border-style: solid;
  772. border-width: 6px;
  773. }
  774. .uni-popper__arrow {
  775. filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.03));
  776. left: 10%;
  777. margin-right: 3px;
  778. border-top-width: 0;
  779. border-bottom-color: #EBEEF5;
  780. }
  781. .uni-popper__arrow::after {
  782. content: " ";
  783. top: 1px;
  784. margin-left: -6px;
  785. border-top-width: 0;
  786. border-bottom-color: #fff;
  787. }
  788. .uni-select__input-text {
  789. // width: 280px;
  790. width: 90%;
  791. color: $uni-main-color;
  792. white-space: nowrap;
  793. text-overflow: ellipsis;
  794. -o-text-overflow: ellipsis;
  795. overflow: hidden;
  796. }
  797. .uni-select__input-placeholder {
  798. color: $uni-base-color;
  799. font-size: 12px;
  800. }
  801. .uni-select--mask {
  802. position: fixed;
  803. top: 0;
  804. bottom: 0;
  805. right: 0;
  806. left: 0;
  807. z-index: 2;
  808. }
  809. </style>