@smt-ui/component
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "@smt-ui/component", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "extension base", | ||
@@ -47,3 +47,3 @@ "author": "jialipeng <jialipeng@baidu.com>", | ||
}, | ||
"gitHead": "5c6ba12cf9231f0ec9cbf78ed8877ab297ce3d8a" | ||
"gitHead": "da32730f7e7577f781fc14a833df1cc201687976" | ||
} |
@@ -47,2 +47,6 @@ /** | ||
export const NAV_PROPS = { | ||
homePagePaths: { | ||
type: Array, | ||
value: [] | ||
}, | ||
navigationStyle: { | ||
@@ -49,0 +53,0 @@ type: Object, |
@@ -41,4 +41,2 @@ /** | ||
backIcon: { | ||
type: Boolean, | ||
value: true, | ||
observer(n) { | ||
@@ -49,4 +47,2 @@ this.initIcons(); | ||
homeIcon: { | ||
type: Boolean, | ||
value: false, | ||
observer(n) { | ||
@@ -75,5 +71,8 @@ this.initIcons(); | ||
attached: function () { | ||
const curPages = getCurrentPages().length; | ||
// 当前页面为二级页面,版本号大于2.28.0 | ||
if (compareVersion(swanNativeVersion, '2.28.0') >= 0 && curPages > 1) { | ||
const homePagePaths = this.data.homePagePaths; | ||
this.showHomeIcon = !homePagePaths.includes(getCurrentPages()[0].route); | ||
this.showBackIcon = getCurrentPages().length > 1; | ||
// 版本号大于2.28.0 | ||
if (compareVersion(swanNativeVersion, '2.28.0') >= 0) { | ||
// 走非兼容性逻辑 | ||
@@ -105,11 +104,25 @@ this.setData({ | ||
} = this.data; | ||
/** | ||
* 1. 首页icon逻辑 | ||
* 如果用户配置了homeIcon,则以用户配置的为准; | ||
* 如果没有配置,则判定是否为首页,不是首页的话显示小房子 | ||
* | ||
* 2. 返回icon的逻辑 | ||
* 如果是高版本,则完全隐藏,走非兼容性改造逻辑 | ||
* 如果不是非兼容性改造,则: | ||
* 1)用户配置了backIcon,以用户配置为准 | ||
* 2)如果没有配置,则判定是否为首页,不是首页则显示返回 | ||
*/ | ||
this.setData({ | ||
icons: [{ | ||
type: 'arrow-left', | ||
show: nonCompatible ? false : backIcon, | ||
show: nonCompatible | ||
? false | ||
: (backIcon === undefined ? this.showBackIcon : backIcon), | ||
size: backIconSize | ||
}, { | ||
type: 'home', | ||
show: homeIcon, | ||
show: homeIcon === undefined | ||
? this.showHomeIcon | ||
: homeIcon, | ||
size: homeIconSize | ||
@@ -116,0 +129,0 @@ }] |
@@ -23,11 +23,5 @@ /** | ||
// 是否显示返回图标 | ||
backIcon: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
backIcon: {}, | ||
// 是否显示首页图标 | ||
homeIcon: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
homeIcon: {}, | ||
// 切换模式下的初始bar | ||
@@ -91,3 +85,6 @@ commonBar: { | ||
const self = this; | ||
let currPath = this.pageinstance.privateProperties.accessUri; | ||
currPath = currPath.replace(/([\?|\=|\&])/g, $0 => '\\' + $0); | ||
Page.after({ | ||
url: new RegExp(currPath), | ||
methods: { | ||
@@ -117,4 +114,6 @@ onPageScroll(context) { | ||
methods: { | ||
/** | ||
* 切换顶部bar | ||
* | ||
* @param {Object} params 滚动参数 | ||
@@ -126,4 +125,3 @@ */ | ||
switchEndPosition, | ||
fixedBar, | ||
switchAnimation | ||
fixedBar | ||
} = this.data; | ||
@@ -151,3 +149,3 @@ const scrollTop = params.scrollTop; | ||
... this.data.fixedBar, | ||
opacity: switchAnimation ? fixedOpacity : 1 | ||
opacity: fixedOpacity || 1 | ||
} | ||
@@ -154,0 +152,0 @@ }); |
@@ -1,1 +0,1 @@ | ||
{"name":"component","label":"通用","type":"component","configPath":"./smart-design-config.json","version":"1.1.100"} | ||
{"name":"component","label":"通用","type":"component","configPath":"./smart-design-config.json","version":"1.2.0"} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1075899
16167