initial: bootstrap from BukidBountyApp base
This commit is contained in:
42
resources/js/Components/Core/Layouts/Buttons/BaseButton.vue
Normal file
42
resources/js/Components/Core/Layouts/Buttons/BaseButton.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<template>
|
||||
<button
|
||||
:id="idtext"
|
||||
:value="value"
|
||||
:class="computedClass"
|
||||
v-bind="additionalData"
|
||||
@click="handleClick"
|
||||
>
|
||||
<img v-if="img" :src="img" class="btn-icon" />
|
||||
<slot>{{ content }}</slot>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
content: { type: String, default: '' },
|
||||
value: { type: [String, Number], default: '' },
|
||||
idtext: { type: String, default: '' },
|
||||
btnClass: { type: String, default: '' }, // custom classes
|
||||
block: { type: Boolean, default: false },
|
||||
img: { type: String, default: '' },
|
||||
additionalData: { type: Object, default: () => ({}) },
|
||||
onClick: { type: Function, default: null }
|
||||
})
|
||||
|
||||
const computedClass = computed(() => {
|
||||
return `${props.btnClass} ${props.block ? 'btn-block' : ''}`.trim()
|
||||
})
|
||||
|
||||
function handleClick(event) {
|
||||
if (props.onClick) props.onClick(event)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.btn-icon {
|
||||
margin-right: 0.5rem;
|
||||
height: 1em;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<BaseButton v-bind="$props" btn-class="btn btn-danger" />
|
||||
</template>
|
||||
<script setup>
|
||||
import BaseButton from './BaseButton.vue'
|
||||
defineProps({
|
||||
content: String,
|
||||
value: String,
|
||||
idtext: String,
|
||||
block: Boolean,
|
||||
img: String,
|
||||
additionalData: Object,
|
||||
onClick: Function
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<BaseButton v-bind="$props" :btn-class="btnClass || 'btn btn-primary'">
|
||||
<slot />
|
||||
</BaseButton>
|
||||
</template>
|
||||
<script setup>
|
||||
import BaseButton from './BaseButton.vue'
|
||||
defineProps({
|
||||
content: String,
|
||||
value: String,
|
||||
idtext: String,
|
||||
block: Boolean,
|
||||
img: String,
|
||||
btnClass: String,
|
||||
additionalData: Object,
|
||||
onClick: Function
|
||||
})
|
||||
</script>
|
||||
@@ -0,0 +1,18 @@
|
||||
<template>
|
||||
<BaseButton v-bind="$props" :btn-class="btnClass || 'btn btn-warning'">
|
||||
<slot />
|
||||
</BaseButton>
|
||||
</template>
|
||||
<script setup>
|
||||
import BaseButton from './BaseButton.vue'
|
||||
defineProps({
|
||||
content: String,
|
||||
value: String,
|
||||
idtext: String,
|
||||
block: Boolean,
|
||||
img: String,
|
||||
btnClass: String,
|
||||
additionalData: Object,
|
||||
onClick: Function
|
||||
})
|
||||
</script>
|
||||
Reference in New Issue
Block a user