mirror of
https://github.com/tenrok/maska.git
synced 2026-05-15 11:59:38 +03:00
55 lines
1.5 KiB
HTML
55 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Maska Alpine Demo</title>
|
|
</head>
|
|
<body>
|
|
<div x-data="{
|
|
maskedvalue: '123',
|
|
unmaskedvalue: '',
|
|
options: { eager: true }
|
|
}">
|
|
<input
|
|
x-model="maskedvalue"
|
|
x-maska:unmaskedvalue.unmasked="options"
|
|
x-on:maska="console.log($event.detail)"
|
|
data-maska="##-##"
|
|
>
|
|
<div><label><input type="checkbox" x-model="options.eager"> eager?</label></div>
|
|
<div>masked value: <span x-text="maskedvalue"></span></div>
|
|
<div>unmasked value: <span x-text="unmaskedvalue"></span></div>
|
|
</div>
|
|
|
|
<div x-data="{
|
|
maskedvalue: '-1234.90',
|
|
unmaskedvalue: '',
|
|
options: { number: { locale: 'ru', fraction: 2 }}
|
|
}" style="margin-top: 1em">
|
|
<input
|
|
x-model="maskedvalue"
|
|
x-maska:unmaskedvalue.unmasked="options"
|
|
x-on:maska="console.log($event.detail)"
|
|
>
|
|
<div>masked value: <span x-text="maskedvalue"></span></div>
|
|
<div>unmasked value: <span x-text="unmaskedvalue"></span></div>
|
|
</div>
|
|
|
|
<div x-data style="margin-top: 1em">
|
|
<input x-maska data-maska="+1 (###) ###-####" data-maska-eager value="1234567">
|
|
</div>
|
|
|
|
<script type="module">
|
|
import Alpine from 'alpinejs'
|
|
import { xMaska } from './src'
|
|
|
|
Alpine.plugin(xMaska)
|
|
|
|
window.Alpine = Alpine
|
|
Alpine.start()
|
|
</script>
|
|
</body>
|
|
</html>
|