Commit a8434f56 by luyt

feat:调整标题

1 parent 660fe85c
......@@ -66,9 +66,11 @@ Page({
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
// wx.setNavigationBarTitle({
// title: " "+item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&phone=${phone}`
......@@ -106,9 +108,11 @@ Page({
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title2',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
// wx.setNavigationBarTitle({
// title: " "+item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
......
......@@ -4,6 +4,5 @@
"apply-button":"../viewVideo/components/apply-button/index",
"van-tab": "@vant/weapp/tab/index",
"van-tabs": "@vant/weapp/tabs/index"
}
}
\ No newline at end of file
......@@ -62,9 +62,10 @@ Page({
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
// wx.setNavigationBarTitle({
// title: item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
this.shareQuery = `sceneCode=${senceItem?.sceneCode}&productCode=${item?.productCode}&isShare=${true}&productDesc=${item?.productName}&category=${item?.category}&actNum=${actNum}&activeNavIdx=${activeNavIdx}&phone=${phone}`
......@@ -102,9 +103,10 @@ Page({
let item = senceData[actNum]?.productList[activeNavIdx]
console.log('title2',item.productName)
setTimeout(() => {
wx.setNavigationBarTitle({
title: item.productName,
});
// wx.setNavigationBarTitle({
// title: item.productName,
// });
utils.setNavigationBarTitle(item.productName)
},100)
......
......@@ -93,9 +93,10 @@ Page({
setpagesTitle(){
//设置标题
let {videoitem} = this.data
wx.setNavigationBarTitle({
title: videoitem.name,
});
// wx.setNavigationBarTitle({
// title: videoitem.name,
// });
utils.setNavigationBarTitle(videoitem.name)
},
// 视频下载
downVideo() {
......
......@@ -160,6 +160,7 @@ const getCurrentPageUrl = () =>{
return url
}
// 克隆
const deepClone = (target) => {
const map = new WeakMap()
......@@ -223,6 +224,39 @@ const deepClone = (target) => {
return clone(target)
}
//设置标题
const setNavigationBarTitle = (title) =>{
wx.getSystemInfo({
success: (res) => {
// console.log('++++++++++++++', res);
// console.log('title length',title.length)
let width = res.safeArea.width / res.fontSizeSetting;
// console.log('width: ', width);
let space = '';
// for (let i = 0; i <= width+4; i++) {
// space = space + ' ';
// }
width = width-(title.length)/2
for (let i = 0; i < width; i++) {
space = space + ' ';
}
if (res.system.includes('iOS') === false) {
wx.setNavigationBarTitle({
title: space + title
});
} else {
wx.setNavigationBarTitle({
title: title
});
}
}
});
}
const Util = {
getImgVersion,
onReachBottom,
......@@ -232,6 +266,7 @@ const Util = {
isEmptyObj,
parseString,
getCurrentPageUrl,
deepClone
deepClone,
setNavigationBarTitle
};
export default Util;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!