AStepItem.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <div
  3. :class="['step-item', link ? 'linkable' : null]"
  4. @click="go"
  5. >
  6. <span :style="titleStyle">{{title}}</span>
  7. <a-icon v-if="icon" :style="iconStyle" :type="icon" />
  8. <slot></slot>
  9. </div>
  10. </template>
  11. <script>
  12. const Group = {
  13. name: 'AStepItemGroup',
  14. props: {
  15. align: {
  16. type: String,
  17. default: 'center',
  18. validator(value) {
  19. return ['left', 'center', 'right'].indexOf(value) != -1
  20. }
  21. }
  22. },
  23. render (h) {
  24. return h(
  25. 'div',
  26. {attrs: {style: `text-align: ${this.align}; margin-top: 8px`}},
  27. [h('div', {attrs: {style: 'text-align: left; display: inline-block;'}}, [this.$slots.default])]
  28. )
  29. }
  30. }
  31. export default {
  32. name: 'AStepItem',
  33. Group: Group,
  34. props: ['title', 'icon', 'link', 'titleStyle', 'iconStyle'],
  35. methods: {
  36. go () {
  37. const link = this.link
  38. if (link) {
  39. this.$router.push(link)
  40. }
  41. }
  42. }
  43. }
  44. </script>
  45. <style lang="less" scoped>
  46. .step-item{
  47. cursor: pointer;
  48. }
  49. :global{
  50. .ant-steps-item-process{
  51. .linkable{
  52. color: @primary-color;
  53. }
  54. }
  55. }
  56. </style>