index.vue 956 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view :class="'jnpf-button jnpf-button-'+align">
  3. <u-button :custom-style="customStyle" :type="realType" :disabled="disabled"
  4. @click="onClick">{{buttonText}}</u-button>
  5. </view>
  6. </template>
  7. <script>
  8. export default {
  9. name: 'jnpf-button',
  10. props: {
  11. align: {
  12. default: 'left'
  13. },
  14. buttonText: {
  15. default: ''
  16. },
  17. disabled: {
  18. type: Boolean,
  19. default: false
  20. },
  21. type: {
  22. default: ''
  23. }
  24. },
  25. computed: {
  26. realType() {
  27. return !this.type ? 'default' : this.type === 'danger' ? 'error' : this.type
  28. }
  29. },
  30. data() {
  31. return {
  32. customStyle: {
  33. display: 'inline-block'
  34. }
  35. }
  36. },
  37. methods: {
  38. onClick(event) {
  39. this.$emit('click', event)
  40. }
  41. }
  42. }
  43. </script>
  44. <style lang="scss" scoped>
  45. .jnpf-button {
  46. width: 100%;
  47. &.jnpf-button-left {
  48. text-align: left;
  49. }
  50. &.jnpf-button-center {
  51. text-align: center;
  52. }
  53. &.jnpf-button-right {
  54. text-align: right;
  55. }
  56. }
  57. </style>