特易招,招聘小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

108 lines
2.5 KiB

8 months ago
  1. <template>
  2. <view
  3. :class="['uv-toolbar',{'uv-border-bottom':showBorder}]"
  4. @touchmove.stop.prevent="noop"
  5. v-if="show"
  6. >
  7. <view
  8. class="uv-toolbar__cancel__wrapper"
  9. hover-class="uv-hover-class"
  10. >
  11. <text
  12. class="uv-toolbar__wrapper__cancel"
  13. @tap="cancel"
  14. :style="{
  15. color: cancelColor
  16. }"
  17. >{{ cancelText }}</text>
  18. </view>
  19. <text
  20. class="uv-toolbar__title uv-line-1"
  21. v-if="title"
  22. >{{ title }}</text>
  23. <view
  24. class="uv-toolbar__confirm__wrapper"
  25. hover-class="uv-hover-class"
  26. >
  27. <text
  28. class="uv-toolbar__wrapper__confirm"
  29. @tap="confirm"
  30. :style="{
  31. color: confirmColor
  32. }"
  33. >{{ confirmText }}</text>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
  39. import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
  40. import props from './props.js';
  41. /**
  42. * Toolbar 工具条
  43. * @description
  44. * @tutorial https://www.uvui.cn/components/toolbar.html
  45. * @property {Boolean} show 是否展示工具条默认 true
  46. * @property {Boolean} showBorder 是否展示工具条下方边框默认 false
  47. * @property {String} cancelText 取消按钮的文字默认 '取消'
  48. * @property {String} confirmText 确认按钮的文字默认 '确认'
  49. * @property {String} cancelColor 取消按钮的颜色默认 '#909193'
  50. * @property {String} confirmColor 确认按钮的颜色默认 '#3c9cff'
  51. * @property {String} title 标题文字
  52. * @event {Function}
  53. * @example
  54. */
  55. export default {
  56. name: 'uv-toolbar',
  57. emits: ['confirm', 'cancel'],
  58. mixins: [mpMixin, mixin, props],
  59. methods: {
  60. // 点击取消按钮
  61. cancel() {
  62. this.$emit('cancel')
  63. },
  64. // 点击确定按钮
  65. confirm() {
  66. this.$emit('confirm')
  67. }
  68. }
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. $show-lines: 1;
  73. $show-hover: 1;
  74. $show-border: 1;
  75. $show-border-bottom: 1;
  76. @import '@/uni_modules/uv-ui-tools/libs/css/variable.scss';
  77. @import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
  78. $uv-tips-color: #909193 !default;
  79. $uv-main-color: #303133 !default;
  80. $uv-primary: #3c9cff !default;
  81. .uv-toolbar {
  82. height: 42px;
  83. @include flex;
  84. justify-content: space-between;
  85. align-items: center;
  86. &__wrapper {
  87. &__cancel {
  88. color: $uv-tips-color;
  89. font-size: 15px;
  90. padding: 0 15px;
  91. }
  92. }
  93. &__title {
  94. color: $uv-main-color;
  95. padding: 0 60rpx;
  96. font-size: 16px;
  97. flex: 1;
  98. text-align: center;
  99. }
  100. &__wrapper {
  101. &__confirm {
  102. color: $uv-primary;
  103. font-size: 15px;
  104. padding: 0 15px;
  105. }
  106. }
  107. }
  108. </style>