vue组件使用iframe内容不显示?

组件里使用iframe内容不显示,我把链接放到独立页面,再路由跳转是可以正常显示内容的,麻烦问下这是什么问题???


代码如下:

父组件:

HTML:  
<div class="componentMain" ref="componentMain">
        <component :is="myComponent" ref="myComponent"></component>
      </div>

JS:
 that.myComponent = 'recommend';

子组件HTML:

 <div class="recommend">
    <iframe width="100%" height="100%" frameborder="0" name="iframe" :url="url"></iframe>
  </div>

子组件JS:

      let that = this;
      let userId = cookie.get('userId');
      let scenicId = cookie.get('scenicId');
      let businessId = that.$store.state.base.businessId;
      that.$store.dispatch('getCodeShopId').then(res => {
        if (!res.customercode || !res.shopid) {
        } else {
          that.url = `https://xxx.XXXXXXXX.html?customercode=${res.customercode}&shopid=${res.shopid}&id=${businessId}&userid=${userId}&scenicareaid=${scenicId}&type=3&source=growmoney`;
        }
      })
阅读 3k
1 个回答
 <div class="recommend">
    <iframe width="100%" height="100%" frameborder="0" name="iframe" :src="url"></iframe>
  </div>

:url改为:src

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏