1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // components/listItem/listItem.js
- const app = getApp()
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- // 数据
- item: {
- type: Object,
- },
- // index => 首页 detatil => 详情 homepage => 个人主页
- pageStatus: {
- type: String,
- default: 'index',
- },
- // 是否收藏
- isCollect:{
- type:Boolean,
- default:false
- },
- // 类名
- listClass:{
- type:String,
- default:"",
- },
- },
-
- /**
- * 组件的初始数据
- */
- data: {
- },
-
- /**
- * 组件的方法列表
- */
- methods: {
- // 进入详情
- goDetails(e) {
- if(this.data.listClass == 'disabled-model-view'){
- return
- }
- let dataset = e.currentTarget.dataset;
- this.triggerEvent('getItem', dataset.item);
- },
- // 进入个人主页
- goHomePage(e){
- let customerid = e.currentTarget.dataset.customerid;
- wx.navigateTo({
- url: '/pages/index/components/homepage/homepage',
- success: function (res) {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('customerid', { customerid })
- }
- })
- },
- // 收藏
- productCollect(e){
- this.triggerEvent('changeCollect');
- },
- // 聊一聊
- goToChat(){
- if(!app.globalData.customerId){
- app.goLogin();
- return
- }
- console.log(`点击了聊一聊`)
- },
- }
- })
|