const isLoading = ref(false);
const adRewardedVideo = ref(null);
<ad-rewarded-video ref="adRewardedVideo" adpid="1507000689" :preload="true" :loadnext="true" :disabled="true"
v-slot:default="{loading, error}" @load="onRewardAdLoad" @close="onRewardAdClose" @error="onRewardAdError">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video>
在vue3里面 const adRewardedVideo = ref(null); 获取ref的话 会有很多的报错 也用了 shallowRef markRaw 都还是报错
Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":203}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":205}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":207}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.586 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":209}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":211}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":213}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Invalid vnode type when creating vnode: null.
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.
Component that was made reactive: {"i":215}
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Component is missing template or render function.
at <Anonymousref_key="adRewardedVideo"ref=Ref<null>adpid="1507000689" ...>
at <Article__pageId=1__pagePath="pages/article/article"__pageQuery={"id":"20735"} ...>
13:36:01.587 [Vue warn]: Unhandled error during execution of app errorHandler
13:36:01.587 Maximum recursive updates exceeded in component <article>. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.
1 个回复
DCloud_uni-ad_HDX
换个名字,例如
const adRewardedVideo1 = ref(null);