图片未显示在 Element-ui 的 <el-carousel></el-carousel> 中

问题描述

我正在尝试在 Vue 框架的 Element-ui 中放置一些图像,但图像没有出现在页面上。我真的是 Vue 框架的新手。任何人都请帮我解决它。

# Python program explaining 
# savetxt() function 
import numpy as geek 

x = geek.array([[1,2],[3,4]])
print("x is:") 
print(x) 

# X is an array 
c = geek.savetxt('geekfile.txt',x,delimiter =',') 
a = open("geekfile.txt",'r')# open file in read mode 

print("the file contains:") 
print(a.read()) 
<template>
<div>
  <el-carousel indicator-position="outside">
    <el-carousel-item v-for="item in img" :key="item">
      <img :src="item" />
    </el-carousel-item>
  </el-carousel>
</div>

谢谢

解决方法

var Main = {
    data() {
    return {
      carouselImages: [
        'https://www.gstatic.com/webp/gallery3/1.png','https://www.gstatic.com/webp/gallery3/2.png',],};
  },};
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
@import url("//unpkg.com/element-ui@2.13.2/lib/theme-chalk/index.css");
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.13.2/lib/index.js"></script>
<div id="app">
<template>
<el-carousel :interval="6000" height="200px">
  <el-carousel-item v-for="item in carouselImages" :key="item">
    <img :src="item" class="image">
   </el-carousel-item>
</el-carousel>
</template>
</div>