index.vue 1.43 KB
<template>
  <div v-if="type === 'primary'" class="button-primary" @click="handle">
    <slot></slot>
  </div>
  <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>

<script setup>
import { ref, reactive, onMounted } from 'vue'
const props = defineProps({
  type: String,
  customStyle: Object
})
const emit = defineEmits(['on-click']);
const handle = () => {
  emit('on-click', '')
}
  onMounted(() => {
    
  })
</script>

<script>
export default {
  data () {
    return {

    }
  },
  mounted () {

  },
  methods: {

  }
}
</script>

<style lang="less" scoped>
@base: #F9D95C;
  .button-primary {
    width: auto;
    height: auto;
    text-align: center;
    padding: 0.6rem;
    margin: 0.5rem;
    font-size: 1rem;
    background: @base;
    border-radius: 24px;
    border: 1px solid @base;
    color: #713610;
    font-weight: bold;
  }
  .button-plain {
    width: auto;
    height: auto;
    text-align: center;
    padding: 0.6rem;
    margin: 0.5rem;
    font-size: 1rem;
    background: #FFFFFF;
    border-radius: 24px;
    border: 1px solid #713610;
    color: #713610;
    font-weight: bold;
  }
  .button-custom {
    width: auto;
    height: auto;
    text-align: center;
    padding: 0.6rem;
    font-size: 1rem;
    border-radius: 24px;
    border: 1px solid;
  }
</style>