第一次见到那么离谱的代码,完全没有封装的意思。
if ($config['theme'] == 1) {
if ($config['plugin']['PG_SHOPPING_CART']) {
$tabIndex = [
'index' => 0,
'collection' => 1,
'bestforyou' => 2,
'cart' => 3,
'mine' => 4
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/theme1_home_actived.png',
],
[
"pagePath" => "/pages/collection/collection",
"iconPath" => "/assets/images/collection.png",
"selectedIconPath" => "/assets/images/collection_actived.png",
"text" => "收藏"
],
[
"pagePath" => "/pages/bestforyou/bestforyou",
"iconPath" => "/assets/images/bestforyou_unactived.png",
"selectedIconPath" => "/assets/images/bestforyou_actived.png",
"text" => "为你优选"
],
[
'pagePath' => '/pages/cart/cart',
'text' => '购物车',
'iconPath' => '/assets/images/cart_unactived.png',
'selectedIconPath' => '/assets/images/cart_actived.png',
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
} else {
$tabIndex = [
'index' => 0,
'collection' => 1,
'bestforyou' => 2,
'mine' => 3
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/theme1_home_actived.png',
],
[
"pagePath" => "/pages/collection/collection",
"iconPath" => "/assets/images/collection.png",
"selectedIconPath" => "/assets/images/collection_actived.png",
"text" => "收藏"
],
[
"pagePath" => "/pages/bestforyou/bestforyou",
"iconPath" => "/assets/images/bestforyou_unactived.png",
"selectedIconPath" => "/assets/images/bestforyou_actived.png",
"text" => "为你优选"
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
}
} else {
if ($config['plugin']['PG_SHOPPING_CART']) {
$tabIndex = [
'index' => 0,
'cart' => 1,
'mine' => 2
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/home_actived.png',
],
[
'pagePath' => '/pages/cart/cart',
'text' => '购物车',
'iconPath' => '/assets/images/cart_unactived.png',
'selectedIconPath' => '/assets/images/cart_actived.png',
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
} else {
$tabIndex = [
'index' => 0,
'mine' => 1
];
$tablist = [
[
'pagePath' => '/pages/index/index',
'text' => '首页',
'iconPath' => '/assets/images/home_unactived.png',
'selectedIconPath' => '/assets/images/home_actived.png',
],
[
'pagePath' => '/pages/mine/mine',
'text' => '我的',
'iconPath' => '/assets/images/mine_unactived.png',
'selectedIconPath' => '/assets/images/mine_actived.png',
]
];
}
}
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.