I am currently using the following library: https://www.npmjs.com/package/vue-signature-pad which has the following example: https://codesandbox.io/s/n5qjp3oqv4
I am applying it as the example, but I have it in a modal:
<v-dialog v-model="canvasVehiculo" fullscreen hide-overlay transition="dialog-bottom-transition">
<v-card>
<v-toolbar dark color="primary">
<v-btn icon dark @click="canvasVehiculo = false">
<v-icon>close</v-icon>
</v-btn>
<v-toolbar-title>Seleccionar partes del vehiculo:</v-toolbar-title>
<v-spacer></v-spacer>
<v-toolbar-items>
<v-btn dark flat @click="undo">Deshacer</v-btn>
</v-toolbar-items>
</v-toolbar>
<v-list three-line subheader>
<v-subheader></v-subheader>
<VueSignaturePad
id="signature"
width="100%"
height="450px"
ref="signaturePad"
/>
</v-list>
</v-card>
<script>
import VueSignature from 'vue-signature-pad'; //Unicamente lo importo
</script>
<style scoped>
#signature {
border: double 3px transparent;
border-radius: 5px;
background-image: url('imagen.png');
background-size: 900px 456px;
background-position: center;
background-origin: border-box;
background-clip: content-box, border-box;
}
</style>
If I use it outside of the modal, it works correctly; but in the modal, to make it work, I must modify the size of the screen
(for example, by using the DevTools' Toggle device toolbar
to see the responsive form).
Its due to dialog not having width & height yet when the canvas is initializing within it, to solve it, you can pass the resizeCanvas event call to the options of the component:
<VueSignaturePad
id="signature"
width="100%"
height="200px"
ref="signaturePad"
:options="{onBegin: () => {$refs.signaturePad.resizeCanvas()}}"
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With