hookehuyr

✨ feat(组件): 按钮组件新增自定义样式和点击回调

<template>
<div v-if="type === 'primary'" class="button-primary">
<div v-if="type === 'primary'" class="button-primary" @click="handle">
<slot></slot>
</div>
<div v-if="type === 'plain'" class="button-plain">
<div v-if="type === 'plain'" class="button-plain" @click="handle">
<slot></slot>
</div>
<div v-if="type === 'custom'" :style="customStyle" class="button-custom" @click="handle">
<slot></slot>
</div>
</template>
......@@ -10,9 +13,13 @@
<script setup>
import { ref, reactive, onMounted } from 'vue'
const props = defineProps({
type: String
type: String,
customStyle: Object
})
const emit = defineEmits(['on-click']);
const handle = () => {
emit('on-click', '')
}
onMounted(() => {
})
......@@ -35,6 +42,7 @@ export default {
</script>
<style lang="less" scoped>
@base: #F9D95C;
.button-primary {
width: auto;
height: auto;
......@@ -42,9 +50,9 @@ export default {
padding: 0.6rem;
margin: 0.5rem;
font-size: 1rem;
background: #F9D95C;
background: @base;
border-radius: 24px;
border: 1px solid #F9D95C;
border: 1px solid @base;
color: #0B3A72;
}
.button-plain {
......@@ -59,4 +67,13 @@ export default {
border: 1px solid #0B3A72;
color: #0B3A72;
}
.button-custom {
width: auto;
height: auto;
text-align: center;
padding: 0.6rem;
font-size: 1rem;
border-radius: 24px;
border: 1px solid;
}
</style>
\ No newline at end of file
......