input.js 785 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Page({
  2. data: {
  3. focus: false,
  4. inputValue: '',
  5. },
  6. bindButtonTap() {
  7. this.onFocus();
  8. },
  9. onFocus() {
  10. this.setData({
  11. focus: true,
  12. });
  13. },
  14. onBlur() {
  15. this.setData({
  16. focus: false,
  17. });
  18. },
  19. bindKeyInput(e) {
  20. this.setData({
  21. inputValue: e.detail.value,
  22. });
  23. },
  24. bindHideKeyboard(e) {
  25. if (e.detail.value === '123') {
  26. // 收起键盘
  27. my.hideKeyboard();
  28. }
  29. },
  30. handleSearch(e) {
  31. console.log('search', e.detail.value);
  32. this.setData({
  33. search: e.detail.value,
  34. });
  35. },
  36. doneSearch() {
  37. console.log('doneSearch', this.data.search);
  38. my.hideKeyboard();
  39. },
  40. clearSearch() {
  41. console.log('clear search', this.data.search);
  42. this.setData({
  43. search: '',
  44. });
  45. },
  46. });