提交 6025c589 编写于 作者: fxy060608's avatar fxy060608 提交者: qiang

fix(harmony): 调整 nvue 样式重置方案

上级 18dd1b72
......@@ -21716,8 +21716,7 @@
document.addEventListener("touchmove", disableScrollListener);
}
if (nvueFlexDirection) {
document.body.setAttribute("nvue", "");
document.body.setAttribute("nvue-dir-".concat(nvueFlexDirection), "");
initPageNVueCss(nvueFlexDirection);
}
if (css) {
initPageCss(route);
......@@ -21787,6 +21786,14 @@
scrollTo(selector || scrollTop || 0, duration);
publish();
}
function initPageNVueCss(nvueFlexDirection) {
var element = document.createElement("style");
element.innerHTML = nvueCss(nvueFlexDirection);
document.head.appendChild(element);
}
function nvueCss(nvueFlexDirection) {
return "\nuni-view,\nuni-label,\nuni-swiper-item,\nuni-scroll-view {\n display: flex;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n align-items: stretch;\n align-content: flex-start;\n}\n\nuni-button {\n margin: 0;\n}\n\nuni-view,\nuni-label,\nuni-swiper-item {\n flex-direction: ".concat(nvueFlexDirection, ";\n}\n\nuni-view,\nuni-image,\nuni-input,\nuni-scroll-view,\nuni-swiper,\nuni-swiper-item,\nuni-text,\nuni-textarea,\nuni-video {\n position: relative;\n border: 0px solid #000000;\n box-sizing: border-box;\n}\n\nuni-swiper-item {\n position: absolute;\n}\n");
}
function onVdSync(actions) {
var firstAction = actions[0];
if (firstAction[0] === ACTION_TYPE_PAGE_CREATE) {
......
......@@ -111,8 +111,7 @@ export function onPageCreate({
}
if (nvueFlexDirection) {
document.body.setAttribute('nvue', '')
document.body.setAttribute(`nvue-dir-${nvueFlexDirection}`, '')
initPageNVueCss(nvueFlexDirection)
}
if (css) {
......@@ -209,3 +208,53 @@ export function pageScrollTo(
scrollTo(selector! || scrollTop! || 0, duration!)
publish()
}
function initPageNVueCss(nvueFlexDirection: string) {
const element = document.createElement('style')
element.innerHTML = nvueCss(nvueFlexDirection)
document.head.appendChild(element)
}
function nvueCss(nvueFlexDirection: string) {
return `
uni-view,
uni-label,
uni-swiper-item,
uni-scroll-view {
display: flex;
flex-shrink: 0;
flex-grow: 0;
flex-basis: auto;
align-items: stretch;
align-content: flex-start;
}
uni-button {
margin: 0;
}
uni-view,
uni-label,
uni-swiper-item {
flex-direction: ${nvueFlexDirection};
}
uni-view,
uni-image,
uni-input,
uni-scroll-view,
uni-swiper,
uni-swiper-item,
uni-text,
uni-textarea,
uni-video {
position: relative;
border: 0px solid #000000;
box-sizing: border-box;
}
uni-swiper-item {
position: absolute;
}
`
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册