ASCII码 ASCII码

uni常用的事件

发布于:2022-02-19 16:44:54  栏目:技术文档
  1. <template>
  2. <view class="content">
  3. <view class="" >
  4. <input
  5. style="background: #008000;"
  6. type="text"
  7. @input="input"
  8. @blur="blur()"
  9. @focus="focus()"
  10. @confirm="confirm"
  11. @click="click"
  12. @tap="tap"
  13. @longpress="logpress()"
  14. >
  15. <br>
  16. <br>
  17. <br>
  18. <br>
  19. <button type="default"
  20. @touchstart="touchstart"
  21. @touchend="touchend"
  22. @touchmove="touchmove"
  23. @touchcancel="touchcancel"
  24. >触摸测试 </button>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. data() {
  31. return {}
  32. },
  33. methods: {
  34. input(){
  35. console.log("input的val")
  36. },
  37. blur(){
  38. console.log("失去了焦点")
  39. },
  40. focus(){
  41. console.log("获取了焦点")
  42. },
  43. confirm(){
  44. console.log('回车')
  45. },
  46. click(){
  47. console.log('单机事件')
  48. },
  49. tap(){
  50. //手机端的触摸事件优先级比click高
  51. console.log('手机端的点击事件')
  52. },
  53. logpress(){
  54. console.log('手机端的长按事件')
  55. },
  56. touchstart(){
  57. console.log('触摸开始')
  58. },
  59. touchend(){
  60. console.log('触摸结束')
  61. },
  62. touchmove(){
  63. console.log('触摸移动')
  64. },
  65. touchcancel(){
  66. console.log('触摸被打断')
  67. }
  68. }
  69. }
  70. </script>
  71. <style>
  72. </style>
相关推荐
阅读 +