如何解决离子 Vue 幻灯片错误?我错过了什么?
我在使用 Ionic Slides 时遇到问题。在更新幻灯片内容之前,一切都按预期工作。我在这里做错了吗?这是我重现问题的代码:
<template>
<ion-content>
<ion-button @click="updateSlides()">Update Slides</ion-button>
<ion-slides pager="true" :options="slideOpts">
<ion-slide
v-for="slide in slides"
:key="slide.id">
<h1> {{ slide.id }} | {{ slide.text }} </h1>
</ion-slide>
</ion-slides>
</ion-content>
</template>
<script>
import { IonSlides,IonSlide,IonContent,IonButton } from '@ionic/vue';
import { defineComponent } from 'vue';
export default defineComponent({
components: { IonSlides,IonButton },data() {
return {
slides: [
{ id: 1,text: "first slide" },{ id: 2,text: "second slide" },{ id: 3,text: "third slide" },]
}
},methods: {
updateSlides () {
this.slides = [
{ id: 4,text: "new slide" },{ id: 5,{ id: 6,]
}
},setup() {
// Optional parameters to pass to the swiper instance. See http://idangero.us/swiper/api/ for valid options.
const slideOpts = {
initialSlide: 1,speed: 400
};
return { slideOpts }
}
});
</script>
这里是错误:
runtime-core.esm-bundler.js?5c40:38 [Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next
at <Anonymous key=6 >
at <Anonymous pager="true" options= {initialSlide: 1,speed: 400} >
at <IonContent isInOutlet=true registerIonPage=fn<registerIonPage> >
at <Home ref=Ref< Proxy {updateSlides: ƒ, …} > key="/home" isInOutlet=true ... >
at <IonRouterOutlet>
at <IonApp>
at <App>
Uncaught (in promise) DOMException: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node.
at insert (webpack-internal:///./node_modules/@vue/runtime-dom/dist/runtime-dom.esm-bundler.js:242:16)
at mountElement (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4944:9)
at processElement (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4885:13)
at patch (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:4793:21)
at componentEffect (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5330:21)
at reactiveEffect (webpack-internal:///./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js:71:24)
at effect (webpack-internal:///./node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js:46:9)
at setupRenderEffect (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5276:89)
at mountComponent (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5235:9)
at processComponent (webpack-internal:///./node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js:5193:17)
它与我的另一个 question 之一相关的问题,我错了,看起来错误来自内容更改,但我不知道我应该如何更新幻灯片以避免它。
如果有人能提供帮助,我将不胜感激。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。