update path

This commit is contained in:
LittleBoy 2021-02-08 20:01:34 +08:00
parent 17e1b0a4df
commit d3de664344
5 changed files with 17 additions and 12 deletions

3
index.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
import Keyboard from './src/components/Keyboard.vue'
export default Keyboard

View File

@ -1,4 +1,4 @@
import Keyboard from '@/components/Keyboard.vue' import Keyboard from './src/components/Keyboard.vue'
Keyboard.install = function(Vue) { Keyboard.install = function(Vue) {
Vue.component(Keyboard.name, Keyboard) Vue.component(Keyboard.name, Keyboard)

View File

@ -3,6 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"main": "index.js", "main": "index.js",
"types": "index.d.ts",
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
@ -10,7 +11,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+http://git.wm-app.xyz/dev/vue-keyborad.git" "url": "git+https://git.wm-app.xyz/dev/vue-keyborad.git"
}, },
"dependencies": { "dependencies": {
"core-js": "^3.6.5", "core-js": "^3.6.5",

View File

@ -18,13 +18,17 @@ export default {
type: String, type: String,
default: '' default: ''
}, },
width:{
type: String,
default: 'auto'
},
space: { space: {
type: Number, type: Number,
default: 20 default: 20
}, },
max: { max: {
type: Number, type: Number,
default: 0 default: -1
} }
}, },
data() { data() {
@ -61,7 +65,11 @@ export default {
console.log('==>', this.space) console.log('==>', this.space)
this.$nextTick(() => { this.$nextTick(() => {
let _width = this.$refs.keyboard.clientWidth - this.space * 10; let _width = this.$refs.keyboard.clientWidth - this.space * 10;
let normal = _width / 10, special = normal * 1.5 + this.space / 2; let normal = _width / 10;
if(this.width){
normal = parseInt(this.width.replace('px',''));
}
const special = normal * 1.5 + this.space / 2;
this.normalWidth = normal + 'px' this.normalWidth = normal + 'px'
this.specialWidth = special + 'px'; this.specialWidth = special + 'px';
this.totalWidth = _width; this.totalWidth = _width;
@ -77,7 +85,7 @@ export default {
this.originValue = v; this.originValue = v;
} else { } else {
// //
if (this.max > 0 && this.originValue.length < this.max) { if (this.max < 0 || (this.max > 0 && this.originValue.length < this.max)) {
this.originValue.push(key); this.originValue.push(key);
} }
} }

View File

@ -4984,13 +4984,6 @@ jsprim@^1.2.2:
json-schema "0.2.3" json-schema "0.2.3"
verror "1.10.0" verror "1.10.0"
"keybord@git+http://git.wm-app.xyz/dev/vue-keyborad.git":
version "0.1.0"
resolved "git+http://git.wm-app.xyz/dev/vue-keyborad.git#9fdaf7b31ab8ad3a40346b88d672f5789b24707d"
dependencies:
core-js "^3.6.5"
vue "^2.6.11"
killable@^1.0.1: killable@^1.0.1:
version "1.0.1" version "1.0.1"
resolved "https://registry.npm.taobao.org/killable/download/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892" resolved "https://registry.npm.taobao.org/killable/download/killable-1.0.1.tgz#4c8ce441187a061c7474fb87ca08e2a638194892"