业务交流通
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

listItem.js 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // components/listItem/listItem.js
  2. const app = getApp()
  3. Component({
  4. /**
  5. * 组件的属性列表
  6. */
  7. properties: {
  8. // 数据
  9. item: {
  10. type: Object,
  11. },
  12. // index => 首页 detatil => 详情 homepage => 个人主页
  13. pageStatus: {
  14. type: String,
  15. default: 'index',
  16. },
  17. // 是否收藏
  18. isCollect:{
  19. type:Boolean,
  20. default:false
  21. },
  22. // 类名
  23. listClass:{
  24. type:String,
  25. default:"",
  26. },
  27. },
  28. /**
  29. * 组件的初始数据
  30. */
  31. data: {
  32. },
  33. /**
  34. * 组件的方法列表
  35. */
  36. methods: {
  37. // 进入详情
  38. goDetails(e) {
  39. if(this.data.listClass == 'disabled-model-view'){
  40. return
  41. }
  42. let dataset = e.currentTarget.dataset;
  43. this.triggerEvent('getItem', dataset.item);
  44. },
  45. // 进入个人主页
  46. goHomePage(e){
  47. let customerid = e.currentTarget.dataset.customerid;
  48. wx.navigateTo({
  49. url: '/pages/index/components/homepage/homepage',
  50. success: function (res) {
  51. // 通过eventChannel向被打开页面传送数据
  52. res.eventChannel.emit('customerid', { customerid })
  53. }
  54. })
  55. },
  56. // 收藏
  57. productCollect(e){
  58. this.triggerEvent('changeCollect');
  59. },
  60. // 聊一聊
  61. goToChat(){
  62. if(!app.globalData.customerId){
  63. app.goLogin();
  64. return
  65. }
  66. console.log(`点击了聊一聊`)
  67. },
  68. }
  69. })