mirror of
				https://github.com/KevinMidboe/planetposen.git
				synced 2025-10-29 17:50:32 +00:00 
			
		
		
		
	Able to disable button component with prop.
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| <template> | <template> | ||||||
|   <button :class="computedClass" @click="$emit('click')"><slot></slot></button> |   <button :class="computedClass" @click="$emit('click')" :disabled="disabled"><slot></slot></button> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script> | <script> | ||||||
| @@ -23,13 +23,18 @@ export default { | |||||||
|     scaleRotate: { |     scaleRotate: { | ||||||
|       type: Boolean, |       type: Boolean, | ||||||
|       default: false |       default: false | ||||||
|  |     }, | ||||||
|  |     disabled: { | ||||||
|  |       type: Boolean, | ||||||
|  |       required: false, | ||||||
|  |       default: false | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|   computed: { |   computed: { | ||||||
|     computedClass() { |     computedClass() { | ||||||
|       let classNames= []; |       let classNames= []; | ||||||
|  |  | ||||||
|       if (this.scaleRotate) |       if (this.scaleRotate && !this.disabled) | ||||||
|         classNames.push('scale-rotate') |         classNames.push('scale-rotate') | ||||||
|       if (this.small) |       if (this.small) | ||||||
|         classNames.push('small'); |         classNames.push('small'); | ||||||
| @@ -94,9 +99,13 @@ button { | |||||||
| } | } | ||||||
|  |  | ||||||
| button .icon { | button .icon { | ||||||
|   position: relative; |   vertical-align: middle; | ||||||
|   top: 2.5px; |   margin-left: 0.3rem; | ||||||
|   right: -8px; |   font-size: 1.4em; | ||||||
|  | } | ||||||
|  |  | ||||||
|  | button[disabled], button:disabled { | ||||||
|  |   cursor: not-allowed; | ||||||
| } | } | ||||||
|  |  | ||||||
| </style> | </style> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user