@michael-chiang-dev5/lib-vue-custom-background
v0.0.2
Published
A vue component for a button that allows the user to select an image. Returns the image as a base64 string.
Downloads
3
Readme
Description
A vue component for a button that allows the user to select an image. Returns the image as a base64 string.
Usage
import { SetBackgroundButton } from '@michael-chiang-dev5/lib-vue-custom-background'
Props
idStr - a string that can be used to style the button via css classStr - a string that can be used to style the button via css
Emits
update - passes the image as a base64 string
Example
<template>
<div :style="{ backgroundImage: `url(${backgroundImageData})`, width: '800px', height: '600px' }">
</div>
<SetBackgroundButton @update="(image64) => backgroundImageData = image64">Click me</SetBackgroundButton>
</template>
<script setup>
import { ref } from 'vue'
import { SetBackgroundButton } from '@michael-chiang-dev5/lib-vue-custom-background'
const backgroundImageData = ref(null)
</script>