Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <body>
  <div id="app">
    <h2>type三种类型</h2>
    <h4>图片类型(默认)</h4>
    <ele-gallery source="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></ele-gallery>
    <h4>视频类型</h4>
    <ele-gallery
      source="https://vjs.zencdn.net/v/oceans.mp4"
      type="video"
    ></ele-gallery>
    <h4>iframe</h4>
    <ele-gallery
      source="https://player.bilibili.com/player.html?aid=68862905&cid=119344504&page=1"
      type="iframe"
    ></ele-gallery>

    <h2>source属性的四种写法</h2>
    <h4>单个(字符串)</h4>
    <ele-gallery source="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"></ele-gallery>
    <h4>多个(数组)</h4>
    <ele-gallery
      :source="[
        'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
      ]"
    ></ele-gallery>
    <h4>单个(对象, 用于指定弹窗标题和缩略图)</h4>
    <ele-gallery
      :source="{
        title: '秀丽山河',
        src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        thumb: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
      }"
    ></ele-gallery>
    <h4>多个(对象, 用于指定弹窗标题和缩略图)</h4>
    <ele-gallery
      :source="[
        {
          title: '秀丽山河',
          src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
          thumb: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          title: '秀丽山河2',
          src: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
          thumb: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
        }
      ]"
    ></ele-gallery>

    <h2>定制化缩略图</h2>
    <h4>样式自定义</h4>
    <ele-gallery
      :height="180"
      :source="[
        'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
      ]"
      :thumb-style="{
        borderRadius: '3px'
      }"
      :width="300"
    ></ele-gallery>
    <h4>插槽</h4>
    <ele-gallery
      :source="[
        {
          title: '秀丽山河',
          src: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
          thumb: 'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg'
        },
        {
          title: '秀丽山河2',
          src: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
          thumb: 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
        }
      ]"
    >
      <template v-slot:default="{index, source }">
        <el-card style="text-align: center">
          <img
            :src="source.thumb"
            style="width: 150px"
          >
          <div style="margin-top: 10px;">{{source.title}}</div>
        </el-card>
      </template>
    </ele-gallery>
    <h2>定制化轮播图属性</h2>
    <ele-gallery
      :carousel-attrs="{
        interval: 4000,
        type: 'card',
        height: '200px'
      }"
      :source="[
        'https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg',
        'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg',
        'https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg',
        'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg',
        'https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg',
        'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg'
      ]"
    ></ele-gallery>
    <h2>其他</h2>
    <h4>删除</h4>
    <ele-gallery
      :remove-fn="handleRemove"
      source="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg"
    ></ele-gallery>
    <h4>action 插槽</h4>
    <ele-gallery source="https://fuss10.elemecdn.com/e/5d/4a731a90594a4af544c0c25941171jpeg.jpeg">
      <template v-slot:action="{index, source}">
        <span>
          <i class="el-icon-folder-opened"></i>
        </span>
        <span>
          <i class="el-icon-headset"></i>
        </span>
      </template>
    </ele-gallery>
  </div>
</body>
              
            
!

CSS

              
                
              
            
!

JS

              
                new Vue({
  el: '#app',
  methods: {
    handleRemove (index) {
      console.log(index)
    }
  }
})
              
            
!
999px

Console