123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- // pages/components/blockItem/blockItem.js
- Component({
- /**
- * 组件的属性列表
- */
- properties: {
- item_data: {
- type:Object
- }
- },
- ready(){
- // console.log(this.properties.item_data);
- },
- /**
- * 组件的初始数据
- */
- data: {
- },
- /**
- * 组件的方法列表
- */
- methods: {
- navigator(e){
- const type = e.target.dataset.type;
- const target_data = e.target.dataset.target;
- const title = e.target.dataset.title;
- if(!type)return;
- switch(type){
- case "url":{
- let attr = encodeURIComponent(`${target_data}&title=${title}`);
- console.log(attr);
- wx.navigateTo({
- url: '/pages/webView/webView?url='+attr
- })
- break;
- }
- case "special":{
- wx.navigateTo({
- url: `/pages/special/special?special_id=${target_data}&title=${title}`
- })
- break;
- }
- case "goods":{
- wx.navigateTo({
- url: `/pages/details/details?goods_id=${target_data}&title=商品详情`
- })
- break;
- }
- case "brand":{
- wx.navigateTo({
- url: `/pages/brand/brand?brand_id=${target_data}&title=${title}`
- })
- break;
- }
- default: {
- console.log(type+'类型找不到');
- }
- }
- }
- }
- })
|