Skip to content

Instantly share code, notes, and snippets.

@phuclh
Last active June 18, 2020 16:52
Show Gist options
  • Save phuclh/6bf770e8aa9814c36bf92a0f93539d80 to your computer and use it in GitHub Desktop.
Save phuclh/6bf770e8aa9814c36bf92a0f93539d80 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Livewire;
use Livewire\Component;
class ESign extends Component
{
public $signature;
public function render()
{
return view('livewire.e-sign');
}
}
<fieldset class="Quiz--inputgroup Form--inputgroup Signature">
<div class="flex justify-between">
<label class="Quiz--label Form--label Signature--label">Signature</label>
</div>
<div>
<div class="Quiz--input Form--input Signature--input w-auto inline-block">
<canvas contenteditable="" width="400" height="200" id="signature-pad"
style="touch-action: none;" spellcheck="false"></canvas>
</div>
<button id="save" type="button">Save</button>
</div>
<div>Signature Data: {{ $signature }}</div>
<script>
window.signaturePad = new SignaturePad(document.getElementById('signature-pad'))
document.getElementById('signature-pad').addEventListener('blur', function (event) {
@this.set('signature', signaturePad.toDataURL('image/png'));
});
</script>
</fieldset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment