index.vue 调用不同类型的键盘 - MTTTM/vue-keyboard-cn GitHub Wiki

中文类型&&可以切换其他类型键盘

  • preset
   let data={
   allowEnter: false,
   canSwitchOtherBoard: true,
   inputId: "input-id-1622138235034-eeb5a538-14cd-0130-ca16-dcf78398f65c",
   isFocus: true,
   showZh: true,
   tmpValueNoFlash: "4w000000000102",
   type: "cn",
}
 this.$root.$on(EventKeys["vue-keyboard-cn-focus"],data)

case 1:

  • test

document.querySelector(".key-board-box-item-curr-text").innerText===”中“

  • return true

case 2: (测试是否可以切换[符号键盘])

  • test

await  document.querySelector(".key-board-btn-symbol").trigger("click");
  document.querySelectorAll(".key-board-btn-【").length==1;

return true

case 3:

   
  await  document.querySelector(".key-board-btn-changeNumber").trigger("click");
  document.querySelectorAll(".key-board-btn-%").length==1;


  • return true

英文类型&&禁止切换其他键盘

  • preset
   let data={
   allowEnter: false,
   canSwitchOtherBoard: true,
   inputId: "input-id-1622138235034-eeb5a538-14cd-0130-ca16-dcf78398f65c",
   isFocus: true,
   showZh: true,
   tmpValueNoFlash: "4w000000000102",
   type: "en",
}
 this.$root.$on(EventKeys["vue-keyboard-cn-focus"],data)

case 1:

  • test

document.querySelector(".key-board-box-item-curr-text").innerText===”en“

  • return true

case 2: (测试是否可以切换[数字])

  • test

await  document.querySelector(".key-board-btn-symbol").trigger("click");
  document.querySelectorAll(".key-board-btn-[").length==1;

return false

case 3: (测试是否可以切换[符号键盘])

   
  await  document.querySelector(".key-board-btn-changeNumber").trigger("click");
  document.querySelectorAll(".key-board-btn-1").length==1;


  • return false

int

  • preset
   let data={
   allowEnter: false,
   canSwitchOtherBoard: true,
   inputId: "input-id-1622138235034-eeb5a538-14cd-0130-ca16-dcf78398f65c",
   isFocus: true,
   showZh: true,
   tmpValueNoFlash: "4w000000000102",
   type: "int",
}
 this.$root.$on(EventKeys["vue-keyboard-cn-focus"],data)

case 1:

  • test

document.querySelectorAll(".key-board-btn-1").length==1;

  • return true

float

  • preset
   let data={
   allowEnter: false,
   canSwitchOtherBoard: true,
   inputId: "input-id-1622138235034-eeb5a538-14cd-0130-ca16-dcf78398f65c",
   isFocus: true,
   showZh: true,
   tmpValueNoFlash: "4w000000000102",
   type: "float",
}
 this.$root.$on(EventKeys["vue-keyboard-cn-focus"],data)

case 1:

  • test

document.querySelectorAll(".key-board-btn-1").length==1;

  • return true