如何在Gridsome页面/模板中嵌入Wistia Channel视频库

问题描述

我正在使用Gridsome建立一个网站。我想在其中一个页面上嵌入Wista Channel视频库。如果您看一下代码,我想将其放在那里的图像顶部的“ frame” div类中。但是,我不确定应该在哪里或如何放置Wistia脚本。任何帮助,将不胜感激。这是Gridsome页面代码

<template>
  <Layout>
    <div class="top-blue">
      <div class="frame">
          <g-image class="frame" src="../assets/images/top-frame.svg"/>
        </div>
        <div>
          <g-image class="bottom-bg" src="../assets/images/bottom-bg.svg"/>
      </div>
    </div>
  </Layout>
</template>

<script>
export default {
  MetaInfo: {
    title: 'Hello,world!'
  }
}
</script>

<style>
.home-links a {
  margin-right: 1rem;
}

.top-blue{
  background-image: url("../assets/images/top-blue-bg.png");
  width:100%;
}

.frame{
  width:100%;
  z-index:1;
  position: relative;
}


.bottom-bg{
  width:100%;
  position: relative;
  margin-top:-150px;
  margin-bottom:-50px;
}
</style>

这是Wistia gallery的嵌入代码

<script src="https://fast.wistia.com/assets/external/channel.js" async></script><link rel="stylesheet" href="https://fast.wistia.com/embed/channel/project/x2dhyl75kf/font.css" /><div class="wistia_channel wistia_async_x2dhyl75kf mode=inline" style="min-height:100vh;position:relative;width:100%;"></div>

解决方法

您可以将 wistia embed 元素标签直接放入您的 html 元素中

<div class="frame">
  <!-- wistia_embed part -->
  <iframe src="https://fast.wistia.net/embed/iframe/avk9twrrbn" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" allowfullscreen mozallowfullscreen webkitallowfullscreen oallowfullscreen msallowfullscreen width="620" height="349"></iframe>

  <!-- or -->
  <div class="wistia_embed wistia_async_j38ihh83m5" style="height:349px;width:620px">&nbsp;</div>
</div>

然后将 wistia 脚本放入 vue 组件外部的 header/body 元素中。

<script src="https://fast.wistia.net/assets/external/E-v1.js" async></script>
...
,

这不是理想的解决方案,但如果其他人遇到此问题,它确实有效。将 Wistia 视频集合添加到 Gridsome / Vue.js 站点的一种方法是使用带有集合的 src url 的 iframe,而不是 Wistia 嵌入代码。在这种情况下,它看起来像这样:

<iframe src="https://fast.wistia.com/embed/channel/x2dh"
   height = "900px" 
   width = "1200px" 
   style = "2px solid red">
 </iframe>

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...