index.vue 1.69 KB
<!--
 * @Author: hookehuyr hookehuyr@gmail.com
 * @Date: 2022-04-21 10:04:58
 * @LastEditors: hookehuyr hookehuyr@gmail.com
 * @LastEditTime: 2022-06-01 17:07:58
 * @FilePath: /tswj/src/components/MyButton/index.vue
 * @Description: 
-->
<template>
  <div v-if="type === 'primary'" class="button-primary" @click="handle">
    <slot />
  </div>
  <div v-if="type === 'plain'" class="button-plain" @click="handle">
    <slot />
  </div>
  <div v-if="type === 'custom'" :style="customStyle" class="button-custom" @click="handle">
    <slot />
  </div>
</template>

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

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

    }
  },
  mounted () {

  },
  methods: {

  }
}
</script>

<style lang="less" scoped>
  .button-primary {
    width: auto;
    height: auto;
    text-align: center;
    padding: 0.6rem;
    margin: 0.5rem;
    font-size: 1rem;
    background: @base-color;
    border-radius: 24px;
    border: 1px solid @base-color;
    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>