|
@@ -2,8 +2,8 @@
|
|
|
<transition name="nut-board-slide-up" @after-enter="afterEnter" @after-leave="afterLeave">
|
|
<transition name="nut-board-slide-up" @after-enter="afterEnter" @after-leave="afterLeave">
|
|
|
<div class="nut-numberkeyboard" v-show="visible">
|
|
<div class="nut-numberkeyboard" v-show="visible">
|
|
|
<div class="number-board-header">
|
|
<div class="number-board-header">
|
|
|
- <h3 class="tit">键盘标题</h3>
|
|
|
|
|
- <span class="keyboard-close" @click="() => closeBoard()">完成</span>
|
|
|
|
|
|
|
+ <h3 class="tit">{{ title }}</h3>
|
|
|
|
|
+ <span class="keyboard-close" @click="() => closeBoard()" v-if="type == 'default'">完成</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="number-board-body">
|
|
<div class="number-board-body">
|
|
|
<div class="number-board">
|
|
<div class="number-board">
|
|
@@ -14,7 +14,7 @@
|
|
|
@touchmove="event => onTouchMove(item, event)"
|
|
@touchmove="event => onTouchMove(item, event)"
|
|
|
@touchend="onTouchEnd"
|
|
@touchend="onTouchEnd"
|
|
|
>
|
|
>
|
|
|
- <template v-if="item.type == 'number'">{{ item.id }}</template>
|
|
|
|
|
|
|
+ <template v-if="item.type == 'number' || item.type == 'custom'">{{ item.id }}</template>
|
|
|
<img
|
|
<img
|
|
|
v-if="item.type == 'lock'"
|
|
v-if="item.type == 'lock'"
|
|
|
src="https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png"
|
|
src="https://img11.360buyimg.com/imagetools/jfs/t1/146371/38/8485/738/5f606425Eca239740/14f4b4f5f20d8a68.png"
|
|
@@ -26,6 +26,23 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div class="number-board-sidebar" v-if="type == 'rightColumn'">
|
|
|
|
|
+ <div class="key-board-wrapper">
|
|
|
|
|
+ <div
|
|
|
|
|
+ :class="['key', { active: clickKeyIndex == 'delete' }]"
|
|
|
|
|
+ @touchstart="event => onTouchstart({ id: 'delete', type: 'delete' }, event)"
|
|
|
|
|
+ @touchmove="event => onTouchMove({ id: 'delete', type: 'delete' }, event)"
|
|
|
|
|
+ @touchend="onTouchEnd"
|
|
|
|
|
+ >
|
|
|
|
|
+ <img src="https://img11.360buyimg.com/imagetools/jfs/t1/129395/8/12735/2030/5f61ac37E70cab338/fb477dc11f46056c.png" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div class="key-board-wrapper" @click="() => closeBoard()">
|
|
|
|
|
+ <div :class="['key', 'finish', { activeFinsh: clickKeyIndex == 'finish' }]">
|
|
|
|
|
+ 完成
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</transition>
|
|
</transition>
|
|
@@ -34,13 +51,28 @@
|
|
|
export default {
|
|
export default {
|
|
|
name: 'nut-numberkeyboard',
|
|
name: 'nut-numberkeyboard',
|
|
|
props: {
|
|
props: {
|
|
|
|
|
+ title: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ },
|
|
|
visible: {
|
|
visible: {
|
|
|
type: Boolean,
|
|
type: Boolean,
|
|
|
default: false
|
|
default: false
|
|
|
|
|
+ },
|
|
|
|
|
+ type: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: 'default'
|
|
|
|
|
+ },
|
|
|
|
|
+ customKey: {
|
|
|
|
|
+ type: Array,
|
|
|
|
|
+ default: () => []
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
keysList() {
|
|
keysList() {
|
|
|
|
|
+ if (this.type == 'rightColumn') {
|
|
|
|
|
+ return this.genCustomKeys();
|
|
|
|
|
+ }
|
|
|
return this.defaultKey();
|
|
return this.defaultKey();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -65,7 +97,7 @@ export default {
|
|
|
// console.log("在区域内");
|
|
// console.log("在区域内");
|
|
|
} else {
|
|
} else {
|
|
|
// console.log("在区域外");
|
|
// console.log("在区域外");
|
|
|
- if (that.once == 0) {
|
|
|
|
|
|
|
+ if (that.once == 0 && that.visible) {
|
|
|
that.once += 1;
|
|
that.once += 1;
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
@@ -73,12 +105,6 @@ export default {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
- this.$nextTick(() => {
|
|
|
|
|
- var f = that.$el;
|
|
|
|
|
- f.addEventListener('webkitTransitionEnd', () => {
|
|
|
|
|
- console.log(111);
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
getBasicKeys() {
|
|
getBasicKeys() {
|
|
@@ -91,6 +117,17 @@ export default {
|
|
|
defaultKey() {
|
|
defaultKey() {
|
|
|
return [...this.getBasicKeys(), { id: 'lock', type: 'lock' }, { id: 0, type: 'number' }, { id: 'delete', type: 'delete' }];
|
|
return [...this.getBasicKeys(), { id: 'lock', type: 'lock' }, { id: 0, type: 'number' }, { id: 'delete', type: 'delete' }];
|
|
|
},
|
|
},
|
|
|
|
|
+ genCustomKeys() {
|
|
|
|
|
+ const keys = this.getBasicKeys();
|
|
|
|
|
+ const { customKey } = this;
|
|
|
|
|
+ const customKeys = Array.isArray(customKey) ? customKey : [customKey];
|
|
|
|
|
+ if (customKeys.length === 1) {
|
|
|
|
|
+ keys.push({ id: 0, type: 'number' }, { id: customKeys[0], type: 'custom' });
|
|
|
|
|
+ } else if (customKeys.length === 2) {
|
|
|
|
|
+ keys.push({ id: customKeys[0], type: 'custom' }, { id: 0, type: 'number' }, { id: customKeys[1], type: 'custom' });
|
|
|
|
|
+ }
|
|
|
|
|
+ return keys;
|
|
|
|
|
+ },
|
|
|
afterEnter() {
|
|
afterEnter() {
|
|
|
this.$emit('enter');
|
|
this.$emit('enter');
|
|
|
},
|
|
},
|
|
@@ -100,7 +137,7 @@ export default {
|
|
|
onTouchstart(item, event) {
|
|
onTouchstart(item, event) {
|
|
|
event.stopPropagation();
|
|
event.stopPropagation();
|
|
|
this.clickKeyIndex = item.id;
|
|
this.clickKeyIndex = item.id;
|
|
|
- if (item.type == 'number') {
|
|
|
|
|
|
|
+ if (item.type == 'number' || item.type == 'custom') {
|
|
|
this.$emit('input', item.id);
|
|
this.$emit('input', item.id);
|
|
|
}
|
|
}
|
|
|
if (item.type == 'lock') {
|
|
if (item.type == 'lock') {
|