提交 bd3b4b6a 编写于 作者: Q qiang

fix(App): cover-view style

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