From 0a98958a2a33f0d4354193b8e1e12596ba64f419 Mon Sep 17 00:00:00 2001
From: yvan.ni <765199919@qq.com>
Date: Tue, 29 Oct 2019 11:42:37 +0800
Subject: [PATCH] 规格使用过滤器
---
pages/goods/goodsInfo/goodsInfo.wxml | 2 +-
utils/filter.wxs | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/pages/goods/goodsInfo/goodsInfo.wxml b/pages/goods/goodsInfo/goodsInfo.wxml
index a7e6615..f0f0176 100644
--- a/pages/goods/goodsInfo/goodsInfo.wxml
+++ b/pages/goods/goodsInfo/goodsInfo.wxml
@@ -464,7 +464,7 @@
规格
- {{data.goods_spec==""?"规格1":data.goods_spec}}
+ {{filters.show_gui_ge(data.goods_spec,data.goods_color)}}
diff --git a/utils/filter.wxs b/utils/filter.wxs
index b652f86..c2baa1b 100644
--- a/utils/filter.wxs
+++ b/utils/filter.wxs
@@ -22,13 +22,23 @@ var filters = {
pInt:function(t) {
var d = parseInt(t); return d;
- }
+ },
+ show_gui_ge:function(spec,color){
+ if((spec=="" || spec==null)){
+ if((color=="" || color==null)){ return "规格1";
+ }else{return color; }
+ }else{
+ if((color=="" || color==null)){ return spec;
+ }else{ return spec+"/"+color; }
+ }
+ }
}
module.exports = {
toFix: filters.toFix,
replace_time:filters.replace_time,
replace_time2: filters.replace_time2,
format_time:filters.format_time,
- pInt:filters.pInt
+ pInt:filters.pInt,
+ show_gui_ge:filters.show_gui_ge
}
\ No newline at end of file
--
libgit2 0.21.4