基于 Vue.js 的模拟数字键盘插件
npm install --save @zee.kim/vue-keypad
首先在项目的入口文件中引入, 调用 Vue.use 安装。
import vueKeypad from '@zee.kim/vue-keypad'
Vue.use(vueKeypad)
<div id="app">
<div @click="input()">${{money}}</div>
<keypad :show="keypad.show" @input="keypad.input"></keypad>
</div>
export default {
data() {
return {
money:"",
keypad:{
show:false,
input:(value)=>{}
},
},
methods:{
input(){
this.keypad.show=true;
this.keypad.input=(value)=>{
this.money=value;
}
}
}
}