index.vue 5.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <uni-shadow-root class="vant-dist-cell-index"><view :class="'custom-class '+(utils.bem('cell', [size, { center, required, borderless: !border, clickable: isLink || clickable }]))" hover-class="van-cell--hover hover-class" hover-stay-time="70" :style="customStyle" @click="onClick">
  3. <van-icon v-if="icon" :name="icon" class="van-cell__left-icon-wrap" custom-class="van-cell__left-icon"></van-icon>
  4. <slot v-else name="icon"></slot>
  5. <view :style="computed.titleStyle({ titleWidth, titleStyle })" class="van-cell__title title-class">
  6. <block v-if="title">{{ title }}</block>
  7. <slot v-else name="title"></slot>
  8. <view v-if="label || useLabelSlot" class="van-cell__label label-class">
  9. <slot v-if="useLabelSlot" name="label"></slot>
  10. <block v-else-if="label">{{ label }}</block>
  11. </view>
  12. </view>
  13. <view class="van-cell__value value-class">
  14. <block v-if="value || value === 0">{{ value }}</block>
  15. <slot v-else></slot>
  16. </view>
  17. <van-icon v-if="isLink" :name="arrowDirection ? 'arrow' + '-' + arrowDirection : 'arrow'" class="van-cell__right-icon-wrap right-icon-class" custom-class="van-cell__right-icon"></van-icon>
  18. <slot v-else name="right-icon"></slot>
  19. <slot name="extra"></slot>
  20. </view></uni-shadow-root>
  21. </template>
  22. <wxs src="../wxs/utils.wxs" module="utils"></wxs><wxs src="./index.wxs" module="computed"></wxs>
  23. <script>
  24. import VanIcon from '../icon/index.vue'
  25. global['__wxVueOptions'] = {components:{'van-icon': VanIcon}}
  26. global['__wxRoute'] = 'vant/dist/cell/index'
  27. import { link } from '../mixins/link';
  28. import { VantComponent } from '../common/component';
  29. VantComponent({
  30. classes: [
  31. 'title-class',
  32. 'label-class',
  33. 'value-class',
  34. 'right-icon-class',
  35. 'hover-class',
  36. ],
  37. mixins: [link],
  38. props: {
  39. title: null,
  40. value: null,
  41. icon: String,
  42. size: String,
  43. label: String,
  44. center: Boolean,
  45. isLink: Boolean,
  46. required: Boolean,
  47. clickable: Boolean,
  48. titleWidth: String,
  49. customStyle: String,
  50. arrowDirection: String,
  51. useLabelSlot: Boolean,
  52. border: {
  53. type: Boolean,
  54. value: true,
  55. },
  56. titleStyle: String,
  57. },
  58. methods: {
  59. onClick(event) {
  60. this.$emit('click', event.detail);
  61. this.jumpLink();
  62. },
  63. },
  64. });
  65. export default global['__wxComponents']['vant/dist/cell/index']
  66. </script>
  67. <style platform="mp-weixin">
  68. @import '../common/index.css';.van-cell{position:relative;display:flex;box-sizing:border-box;width:100%;padding:10px 16px;padding:var(--cell-vertical-padding,10px) var(--cell-horizontal-padding,16px);font-size:14px;font-size:var(--cell-font-size,14px);line-height:24px;line-height:var(--cell-line-height,24px);color:#323233;color:var(--cell-text-color,#323233);background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell:after{position:absolute;box-sizing:border-box;transform-origin:center;content:" ";pointer-events:none;right:16px;bottom:0;left:16px;border-bottom:1px solid #ebedf0;transform:scaleY(.5)}.van-cell--borderless:after{display:none}.van-cell-group{background-color:#fff;background-color:var(--cell-background-color,#fff)}.van-cell__label{margin-top:3px;margin-top:var(--cell-label-margin-top,3px);font-size:12px;font-size:var(--cell-label-font-size,12px);line-height:18px;line-height:var(--cell-label-line-height,18px);color:#969799;color:var(--cell-label-color,#969799)}.van-cell__value{overflow:hidden;text-align:right;vertical-align:middle;color:#969799;color:var(--cell-value-color,#969799)}.van-cell__title,.van-cell__value{flex:1}.van-cell__title:empty,.van-cell__value:empty{display:none}.van-cell__left-icon-wrap,.van-cell__right-icon-wrap{display:flex;align-items:center;height:24px;height:var(--cell-line-height,24px);font-size:16px;font-size:var(--cell-icon-size,16px)}.van-cell__left-icon-wrap{margin-right:4px;margin-right:var(--padding-base,4px)}.van-cell__right-icon-wrap{margin-left:4px;margin-left:var(--padding-base,4px);color:#969799;color:var(--cell-right-icon-color,#969799)}.van-cell__left-icon{vertical-align:middle}.van-cell__left-icon,.van-cell__right-icon{line-height:24px;line-height:var(--cell-line-height,24px)}.van-cell--clickable.van-cell--hover{background-color:#f2f3f5;background-color:var(--cell-active-color,#f2f3f5)}.van-cell--required{overflow:visible}.van-cell--required:before{position:absolute;content:"*";left:8px;left:var(--padding-xs,8px);font-size:14px;font-size:var(--cell-font-size,14px);color:#ee0a24;color:var(--cell-required-color,#ee0a24)}.van-cell--center{align-items:center}.van-cell--large{padding-top:12px;padding-top:var(--cell-large-vertical-padding,12px);padding-bottom:12px;padding-bottom:var(--cell-large-vertical-padding,12px)}.van-cell--large .van-cell__title{font-size:16px;font-size:var(--cell-large-title-font-size,16px)}.van-cell--large .van-cell__value{font-size:16px;font-size:var(--cell-large-value-font-size,16px)}.van-cell--large .van-cell__label{font-size:14px;font-size:var(--cell-large-label-font-size,14px)}
  69. </style>