ExtButton.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <style lang="scss" scoped>
  2. </style>
  3. <template>
  4. <div style="display: inline-block">
  5. <el-tooltip v-if="tips" :content="tips" placement="left-start">
  6. <el-button
  7. :loading="loading"
  8. :size="size"
  9. :plain="plain"
  10. v-auth="auth" :disabled="disabled" :type="type" :text="isText" @click="handleClick">
  11. <SvgIcon v-if="icon" :name="icon"/>
  12. {{ name }}
  13. </el-button>
  14. </el-tooltip>
  15. <el-button v-else
  16. :loading="loading"
  17. :size="size"
  18. :plain="plain"
  19. v-auth="auth" :disabled="disabled" :type="type" :text="isText" @click="handleClick">
  20. <SvgIcon v-if="icon" :name="icon"/>{{ name }}
  21. </el-button>
  22. </div>
  23. </template>
  24. <script setup lang="ts" name="ExtButton">
  25. // 定义子组件向父组件传值/事件
  26. const emit = defineEmits(['on-click']);
  27. // eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
  28. const props = defineProps({
  29. icon:{
  30. type:String
  31. },
  32. name: {
  33. type: String,
  34. require:true,
  35. },
  36. auth: {
  37. type: String
  38. },
  39. plain: {
  40. type: Boolean,
  41. default:true
  42. },
  43. size: {
  44. type: String,
  45. default: "default"
  46. },
  47. tips: {
  48. type: String,
  49. },
  50. disabled: {
  51. type: Boolean,
  52. default: false
  53. },
  54. isText: {
  55. type: Boolean,
  56. default: false
  57. },
  58. type: {
  59. type: String,
  60. default: 'primary'
  61. },
  62. loading:{
  63. type:Boolean,
  64. default:false
  65. }
  66. })
  67. const handleClick = () => {
  68. emit('on-click')
  69. }
  70. </script>