primevue-mirror/doc/inputmask/MaskDoc.vue

111 lines
3.4 KiB
Vue

<template>
<DocSectionText v-bind="$attrs">
<p>
Mask format can be a combination of the following definitions; <i>a</i> for alphabetic characters, <i>9</i> for numeric characters and <i>*</i> for alphanumberic characters. In addition, formatting characters like <i>(</i>, <i>)</i> ,
<i>-</i> are also accepted.
</p>
</DocSectionText>
<div class="card p-fluid flex flex-wrap gap-3">
<div class="flex-auto">
<label for="ssn">SSN</label>
<InputMask id="ssn" v-model="value1" mask="999-99-9999" placeholder="999-99-9999" />
</div>
<div class="flex-auto">
<label for="phone">Phone</label>
<InputMask id="phone" v-model="value2" mask="(999) 999-9999" placeholder="(999) 999-9999" />
</div>
<div class="flex-auto">
<label for="serial">Serial</label>
<InputMask id="serial" v-model="value3" mask="a*-999-a999" placeholder="a*-999-a999" />
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value1: '',
value2: '',
value3: '',
code: {
basic: `<div class="flex-auto">
<label for="ssn">SSN</label>
<InputMask id="ssn" v-model="value1" mask="999-99-9999" placeholder="999-99-9999" />
</div>
<div class="flex-auto">
<label for="phone">Phone</label>
<InputMask v-model="value2" date="phone" mask="(999) 999-9999" placeholder="(999) 999-9999" />
</div>
<div class="flex-auto">
<label for="serial">Serial</label>
<InputMask id="serial" v-model="value3" mask="a*-999-a999" placeholder="a*-999-a999" />
</div>`,
options: `<template>
<div class="card p-fluid flex flex-wrap gap-3">
<div class="flex-auto">
<label for="ssn">SSN</label>
<InputMask id="ssn" v-model="value1" mask="999-99-9999" placeholder="999-99-9999" />
</div>
<div class="flex-auto">
<label for="phone">Phone</label>
<InputMask v-model="value2" date="phone" mask="(999) 999-9999" placeholder="(999) 999-9999" />
</div>
<div class="flex-auto">
<label for="serial">Serial</label>
<InputMask id="serial" v-model="value2" mask="a*-999-a999" placeholder="a*-999-a999" />
</div>
</div>
</template>
<script>
export default {
data() {
return {
value1: '',
value2: '',
value3: ''
}
}
}
<\/script>
`,
composition: `<template>
<div class="card p-fluid flex flex-wrap gap-3">
<div class="flex-auto">
<label for="ssn">SSN</label>
<InputMask id="ssn" v-model="value1" mask="999-99-9999" placeholder="999-99-9999" />
</div>
<div class="flex-auto">
<label for="phone">Phone</label>
<InputMask v-model="value2" date="phone" mask="(999) 999-9999" placeholder="(999) 999-9999" />
</div>
<div class="flex-auto">
<label for="serial">Serial</label>
<InputMask id="serial" v-model="value3" mask="a*-999-a999" placeholder="a*-999-a999" />
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
const value1 = ref('');
const value2 = ref('');
const value3 = ref('');
<\/script>`
}
};
}
};
</script>