【发布时间】:2019-12-25 09:23:13
【问题描述】:
我目前正在使用 Laravel 和 Vue/Vuetify 制作图像轮播,我正在使用 Vuetify v-carousel 和 v-carousel-item 来实现这一点,除了轮播由于错误而无法呈现标题。
我已经根据 vuetify 文档正确初始化了我的 Vuetify 实例(我认为)
--下面的代码是我的 app.js--
import Vue from 'vue'
import Vuetify, {VCarousel} from 'vuetify/lib'
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
Vue.use(Vuetify, {
components: {
VCarousel,
},
})
// export default new Vuetify({})
const app = new Vue({
}).$mount('#app');
--下面的代码是针对使用轮播的组件--
<template>
<v-carousel>
<v-carousel-item v-for="(slide, i) in slides" :src = "slide.content " :key=i>
</v-carousel-item>
<v-carousel-item>
<!-- <v-playback autoPlay :url = "video" :type="video/mp4" :width = "720" @play = "pauseCarousel" @pause = "playCarousel" ref = 'videoPlayer'></v-playback> -->
</v-carousel-item>
</v-carousel>
</template>
这给了我这个错误
[Vue warn]: Error in render: "TypeError: Cannot read property 't' of undefined"
found in
---> <VCarousel>
<ImageCarousel> at resources/js/components/ImageCarousel.vue
<ExampleComponent> at resources/js/components/ExampleComponent.vue
<Root>
【问题讨论】:
-
您收到此错误是因为您可能使用了 firefox。切换到chrome,你会得到一个real错误信息。
-
另外,当您在生产环境中构建项目时,您可能会收到
Cannot read property一些字母of undefined。
标签: javascript laravel vue.js vuetify.js