Commit a2f94e61 authored by Roma's avatar Roma

Demo fix, refactor

parent 6621311e
.vscode
.DS_Store .DS_Store
node_modules/ node_modules/
npm-debug.log npm-debug.log
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{ {
"name": "vue-masked-input", "name": "vue-masked-input",
"description": "Masked input component for Vue.js 2.X", "description": "Masked input component for Vue.js 2.X",
"version": "0.3.2", "version": "0.3.3",
"author": "niksmr", "author": "niksmr",
"license": "MIT", "license": "MIT",
"homepage": "https://github.com/niksmr/vue-masked-input", "homepage": "https://github.com/niksmr/vue-masked-input",
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
<li>+ – any character</li> <li>+ – any character</li>
</ul> </ul>
<temp v-model="date" mask="11 / 11 / 1111" placeholder="Date" name="date"/>
<h4>Date: </h4> <h4>Date: </h4>
<masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date"/><span>{{ date }}</span> <masked-input v-model="date" mask="11 / 11 / 1111" placeholder="Date"/><span>{{ date }}</span>
<p class="code"> <p class="code">
......
...@@ -91,8 +91,8 @@ export default { ...@@ -91,8 +91,8 @@ export default {
}, },
} }
}) })
for (let i = 0; i < this.$refs.input.value.length; ++i) { for (const char of this.$refs.input.value) {
this.mask_core.input(this.$refs.input.value[i]) this.mask_core.input(char)
} }
this.mask_core.setSelection({ this.mask_core.setSelection({
start: 0, start: 0,
...@@ -222,8 +222,8 @@ export default { ...@@ -222,8 +222,8 @@ export default {
/* /*
IE & FF are not trigger textInput event, so we have to force it IE & FF are not trigger textInput event, so we have to force it
*/ */
let isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser const isIE = /*@cc_on!@*/false || !!document.documentMode; //by http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
let isFirefox = typeof InstallTrigger !== 'undefined'; const isFirefox = typeof InstallTrigger !== 'undefined';
if (isIE || isFirefox) { if (isIE || isFirefox) {
...@@ -267,9 +267,9 @@ export default { ...@@ -267,9 +267,9 @@ export default {
paste(e) { paste(e) {
e.preventDefault() e.preventDefault()
let text = e.clipboardData.getData('text') const pasteText = e.clipboardData.getData('text')
for (let i = 0; i < text.length; ++i) { for (const char of pasteText) {
this.mask_core.input(text[i]) this.mask_core.input(char)
} }
this.updateToCoreState() this.updateToCoreState()
}, },
......
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