Skip to content

Commit 8050b10

Browse files
committed
Feature - Prevent click event option added
1 parent 3ba60f3 commit 8050b10

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/keyboard.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// input(type="text", v-model="keyboardText", v-if="!input")
44
.keyboard
55
.line(v-for="(line, index) in keySet", :key="index")
6-
span(v-for="(key, index) in line", :key="index", :class="getClassesOfKey(key)", v-text="getCaptionOfKey(key)", @click="clickKey(key)", @mousedown="mousedown", :style="getKeyStyle(key)")
6+
span(v-for="(key, index) in line", :key="index", :class="getClassesOfKey(key)", v-text="getCaptionOfKey(key)", @click="e => clickKey(e, key)", @mousedown="mousedown", :style="getKeyStyle(key)")
77

88

99
</template>
@@ -176,15 +176,17 @@
176176
return text;
177177
},
178178
179-
mousedown() {
179+
mousedown(e) {
180180
if (!this.input) return;
181+
if (this.options.preventClickEvent) e.preventDefault();
181182
182183
this.inputScrollLeft = this.input.scrollLeft;
183184
//console.log("mousedown: ", this.input.scrollLeft, this.input.scrollWidth, this.input.clientWidth);
184185
},
185186
186-
clickKey(key) {
187+
clickKey(e, key) {
187188
if (!this.input) return;
189+
if (this.options.preventClickEvent) e.preventDefault();
188190
189191
let caret = this.getCaret();
190192
let text = this.input.value;

0 commit comments

Comments
 (0)