Commit 83236c58 authored by NikulinR's avatar NikulinR

PlaceholderChar customize added

parent 3084d376
......@@ -32,6 +32,11 @@ You can also get a raw user input text if you want. Instead of using v-model you
<masked-input mask="+\\1 (111) 1111-11" placeholder="Phone" @input="rawVal = arguments[1]" />
```
Placeholder character is customizable (`_` by default):
```vue
<masked-input v-model="phone" mask="+\\1 (111) 111-1111" placeholderChar="-" placeholder="Phone number" type="tel" />
```
## Known issues/TODO
* Cut in mobile Chrome
* Cyrillic chars are not supported in mobile Chrome
......
{
"name": "vue-masked-input",
"description": "Masked input component for Vue.js 2.X",
"version": "0.2.3",
"version": "0.2.4",
"author": "niksmr",
"license": "MIT",
"homepage": "https://github.com/niksmr/vue-masked-input",
......
......@@ -15,7 +15,7 @@
<li># – alphanumeric, forced to upper case when entered</li>
</ul>
<h4>Date: </h4>
<masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date"/><span v-if="">{{ date }}</span>
<masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date"/><span>{{ date }}</span>
<p class="code">
&lt;masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date" /&gt;
</p>
......
......@@ -40,11 +40,13 @@ export default {
},
mask: {
type: String,
required: true
required: true,
validator: value => !! (value && value.length >= 1)
},
placeholderChar: {
type: String,
default: '_'
default: '_',
validator: value => !! (value && value.length === 1)
},
},
......@@ -95,8 +97,9 @@ export default {
this.$emit('input', this.default, this.default)
}
catch (e) {
console.error(e.message);
this.mask_core = null
this.$refs.input.value = '0 editable chars in mask'
this.$refs.input.value = 'Error, see console'
this.$emit('input', this.$refs.input.value, '')
}
},
......
//https://gist.github.com/nuxodin/9250e56a3ce6c0446efa
export default function () {
export default () => {
var w = window,
d = w.document;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment