提交 2bda7de6 编写于 作者: fxy060608's avatar fxy060608

fix(h5): change svg icon color when navigation bar transparent

上级 eca4097c
......@@ -20565,7 +20565,7 @@ function usePageHeadTransparent(headRef, {
const offset = parseInt(coverage);
let titleElem;
let transparentElemStyle;
const iconElemsStyles = [];
const iconElemsPaths = [];
const borderRadiusElemsStyles = [];
const oldColors = [];
onMounted(() => {
......@@ -20573,9 +20573,9 @@ function usePageHeadTransparent(headRef, {
transparentElemStyle = $el.style;
titleElem = $el.querySelector(".uni-page-head__title");
const borderRadiusElems = $el.querySelectorAll(".uni-page-head-btn");
const iconElems = $el.querySelectorAll(".uni-btn-icon");
for (let i = 0; i < iconElems.length; i++) {
iconElemsStyles.push(iconElems[i].style);
const iconSvgElems = $el.querySelectorAll("svg path");
for (let i = 0; i < iconSvgElems.length; i++) {
iconElemsPaths.push(iconSvgElems[i]);
}
for (let i = 0; i < borderRadiusElems.length; i++) {
const borderRadiusElem = borderRadiusElems[i];
......@@ -20589,12 +20589,12 @@ function usePageHeadTransparent(headRef, {
return;
}
if (alpha > 0.5 && A <= 0.5) {
iconElemsStyles.forEach(function(iconElemStyle) {
iconElemStyle.color = titleColor;
iconElemsPaths.forEach(function(iconElemPath) {
iconElemPath.setAttribute("fill", titleColor);
});
} else if (alpha <= 0.5 && A > 0.5) {
iconElemsStyles.forEach(function(iconElemStyle) {
iconElemStyle.color = "#fff";
iconElemsPaths.forEach(function(iconElemPath) {
iconElemPath.setAttribute("fill", "#fff");
});
}
A = alpha;
......
......@@ -19,7 +19,7 @@ export function usePageHeadTransparent(
const offset = parseInt(coverage!)
let titleElem: HTMLDivElement
let transparentElemStyle: CSSStyleDeclaration
const iconElemsStyles: CSSStyleDeclaration[] = []
const iconElemsPaths: SVGPathElement[] = []
const borderRadiusElemsStyles: CSSStyleDeclaration[] = []
const oldColors: string[] = []
onMounted(() => {
......@@ -29,11 +29,11 @@ export function usePageHeadTransparent(
const borderRadiusElems = $el.querySelectorAll(
'.uni-page-head-btn'
) as NodeListOf<HTMLElement>
const iconElems = $el.querySelectorAll(
'.uni-btn-icon'
) as NodeListOf<HTMLElement>
for (let i = 0; i < iconElems.length; i++) {
iconElemsStyles.push(iconElems[i].style)
const iconSvgElems = $el.querySelectorAll(
'svg path'
) as NodeListOf<SVGPathElement>
for (let i = 0; i < iconSvgElems.length; i++) {
iconElemsPaths.push(iconSvgElems[i])
}
for (let i = 0; i < borderRadiusElems.length; i++) {
const borderRadiusElem = borderRadiusElems[i]
......@@ -47,12 +47,12 @@ export function usePageHeadTransparent(
return
}
if (alpha > 0.5 && A <= 0.5) {
iconElemsStyles.forEach(function (iconElemStyle) {
iconElemStyle.color = titleColor!
iconElemsPaths.forEach(function (iconElemPath) {
iconElemPath.setAttribute('fill', titleColor!)
})
} else if (alpha <= 0.5 && A > 0.5) {
iconElemsStyles.forEach(function (iconElemStyle) {
iconElemStyle.color = '#fff'
iconElemsPaths.forEach(function (iconElemPath) {
iconElemPath.setAttribute('fill', '#fff')
})
}
A = alpha
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册