提交 bd3b4b6a 编写于 作者: Q qiang

fix(App): cover-view style

上级 6ba224b3
...@@ -12,6 +12,7 @@ export function useCover( ...@@ -12,6 +12,7 @@ export function useCover(
) { ) {
const { position, hidden, onParentReady } = useNative(rootRef) const { position, hidden, onParentReady } = useNative(rootRef)
let cover: PlusNativeObjView let cover: PlusNativeObjView
let requestStyleUpdate: () => void
onParentReady((parentPosition) => { onParentReady((parentPosition) => {
const viewPosition = computed(() => { const viewPosition = computed(() => {
const object: Position = {} as Position const object: Position = {} as Position
...@@ -69,7 +70,7 @@ export function useCover( ...@@ -69,7 +70,7 @@ export function useCover(
} }
const style = reactive(updateStyle({} as CSSStyleDeclaration)) const style = reactive(updateStyle({} as CSSStyleDeclaration))
let request: null | number = null let request: null | number = null
function requestStyleUpdate() { requestStyleUpdate = function () {
if (request) { if (request) {
cancelAnimationFrame(request) cancelAnimationFrame(request)
} }
...@@ -209,5 +210,8 @@ export function useCover( ...@@ -209,5 +210,8 @@ export function useCover(
if (cover) { if (cover) {
cover.close() cover.close()
} }
if (requestStyleUpdate) {
window.removeEventListener('updateview', requestStyleUpdate)
}
}) })
} }
import { Ref, reactive, ref, computed, provide, inject, onMounted } from 'vue' import {
Ref,
reactive,
ref,
computed,
provide,
inject,
onMounted,
onBeforeUnmount,
} from 'vue'
import { getNavigationBarHeight } from './navigationBar' import { getNavigationBarHeight } from './navigationBar'
import { getRealPath } from '../platform/getRealPath' import { getRealPath } from '../platform/getRealPath'
...@@ -137,6 +146,10 @@ export function useNative(rootRef: Ref<HTMLElement | null>) { ...@@ -137,6 +146,10 @@ export function useNative(rootRef: Ref<HTMLElement | null>) {
onSelfReadyCallbacks = null onSelfReadyCallbacks = null
}) })
onBeforeUnmount(() => {
window.removeEventListener('updateview', requestPositionUpdate)
})
return { return {
position, position,
hidden, hidden,
......
...@@ -21,6 +21,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({ ...@@ -21,6 +21,7 @@ export default /*#__PURE__*/ defineBuiltInComponent({
useRebuild(() => { useRebuild(() => {
const node = (textRef.value as HTMLElement).childNodes[0] const node = (textRef.value as HTMLElement).childNodes[0]
content.text = node && node instanceof Text ? node.textContent! : '' content.text = node && node instanceof Text ? node.textContent! : ''
window.dispatchEvent(new CustomEvent('updateview'))
}) })
return () => { return () => {
......
...@@ -13,4 +13,5 @@ uni-cover-view[hidden] { ...@@ -13,4 +13,5 @@ uni-cover-view[hidden] {
uni-cover-view .uni-cover-view { uni-cover-view .uni-cover-view {
width: 100%; width: 100%;
height: 100%; height: 100%;
visibility: hidden;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册