index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // components/My_SearchInputBox/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. /* 搜索方法 */
  8. searchQuery: {
  9. type: Function
  10. },
  11. /* 新增按钮跳转 */
  12. route: {
  13. type: String
  14. },
  15. /* 是否主账号 */
  16. fisadministrator: {
  17. type: Boolean
  18. },
  19. butText: {
  20. type: String,
  21. value: "新增"
  22. },
  23. marTop: {
  24. type: Number,
  25. value: 30
  26. },
  27. inputColor: {
  28. type: String,
  29. value: "#FFFF"
  30. },
  31. inputRadius: {
  32. type: String,
  33. value: "10"
  34. }
  35. },
  36. /**
  37. * 组件的初始数据
  38. */
  39. data: {
  40. text: ""
  41. },
  42. /**
  43. * 组件的方法列表
  44. */
  45. methods: {
  46. /* 输入 */
  47. inputText(e) {
  48. this.setData({
  49. text: e.detail.value
  50. })
  51. },
  52. /* 失去焦点 */
  53. searchBlur(e) {
  54. const {
  55. value
  56. } = e.detail;
  57. this.triggerEvent("searchQuery", value.trim())
  58. },
  59. /* 跳转页面 */
  60. itemAdd() {
  61. if (this.data.route == 'product') {
  62. wx.navigateTo({
  63. url: '/pages/productManagement/change',
  64. })
  65. } else if (this.data.route == 'team') {
  66. wx.navigateTo({
  67. url: '/pages/teamManagement/change',
  68. })
  69. } else if(this.data.route == 'consociation'){
  70. wx.navigateTo({
  71. url: '/pages/businessPartner/applyFor',
  72. })
  73. }
  74. },
  75. /* 清空 */
  76. clearInput() {
  77. this.setData({
  78. text: ""
  79. })
  80. this.triggerEvent("searchQuery", '')
  81. }
  82. }
  83. })