weex icon indicating copy to clipboard operation
weex copied to clipboard

web标签无法拖动

Open thonatos opened this issue 10 years ago • 16 comments

使用web标签加载了一个页面进去,发现不能拖动,是还没支持还是我引入有误呢?

  • oc
  • weexsdk(git)
<scroller if="{{page.trips.shown}}">
    <web class="web" id="webview" src="{{url}}"></web>
</scroller>   

thonatos avatar Jul 08 '16 14:07 thonatos

你说的是‘滚动’吧 web控件本身就是可以滚动 就跟浏览器一样 没必要放到scroller里面

sospartan avatar Jul 09 '16 12:07 sospartan

@sospartan

在web里面嵌入了一个地图,但是在地图上拖动无效,用浏览器打开正常,scroller标签应该不影响这个功能吧

thonatos avatar Jul 10 '16 08:07 thonatos

明白了 这样是有问题 使用的url能贴出来么

sospartan avatar Jul 11 '16 02:07 sospartan

@sospartan

地址是这里: http://implements.io/footprint

换了其他搜索网站也是一样的,无法点击,也无法输入如何信息。

thonatos avatar Jul 11 '16 02:07 thonatos

@sospartan 完整的tpl代码:

<template>
<wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white">
<web class="web" id="webview" src="https://www.baidu.com"></web>
<wxc-tabbar tab-items = {{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>
</wxc-navpage>
</template>

thonatos avatar Jul 13 '16 04:07 thonatos

@zshshr 会跟进这个问题 已经在看了

sospartan avatar Jul 13 '16 05:07 sospartan

嗯,我是发现,直接使用正常,但是用在navpage里面就不正常的

thonatos avatar Jul 13 '16 06:07 thonatos

@thonatos 贴一个能复现问题的最小子页面的代码

YorkShen avatar Jul 26 '16 12:07 YorkShen

@YorkShen

<template>
    <wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white"> 
        <web class="web" id="webview" src="http://implements.io/footprint"></web>  
</template>

<style>
  .web{
      position: absolute; 
      top: 0; 
      left: 0; 
      right: 0; 
      bottom: 0; 
      height:750;
  }
</style>

<script>     
  require('weex-components');
  var webview = require('@weex-module/webview');

  module.exports = {
    data: {
      nav:{
        height: 144,
        title: 'Bianca 🍭'
      }
    },
    created: function() {       
    },
    methods: {
      ready: function (e) {
      },
      go:function(){
        var $webview = require('@weex-module/webview');
        var webElement = this.$el('webview');
        $webview.reload(webElement.ref);       
      }      
    },
  }
</script>

webview无法进行任何操作

thonatos avatar Jul 28 '16 14:07 thonatos

@thonatos 存在两个问题

  • wxc-navpage没有结束标签
  • 目前weex android不支持emoji,所以data.nav.title会导致渲染异常。

以下代码可以正常渲染。

<template>
    <wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title-color="white"> 
        <web class="web" id="webview" src="http://implements.io/footprint"></web>  
        </wxc-navpage>
</template>

<style>
  .web{
      position: absolute; 
      top: 0; 
      left: 0; 
      right: 0; 
      bottom: 0; 
      height:750;
  }
</style>

<script>     
  require('weex-components');
  var webview = require('@weex-module/webview');

  module.exports = {
    data: {
      nav:{
        height: 144,
        title: 'Bianca 🍭'
      }
    },
    created: function() {       
    },
    methods: {
      ready: function (e) {
      },
      go:function(){
        var $webview = require('@weex-module/webview');
        var webElement = this.$el('webview');
        $webview.reload(webElement.ref);       
      }      
    },
  }
</script>

YorkShen avatar Aug 08 '16 03:08 YorkShen

@YorkShen

我发现了,不是你说的问题,是wxc-tabbar嵌套在wxc-navpage里就出错了,另外,我是iOS

thonatos avatar Aug 16 '16 09:08 thonatos

@cxfeng1 看下这个问题

YorkShen avatar Aug 16 '16 10:08 YorkShen

@YorkShen

昨天忘记贴代码了,最后正常的代码是这样,就是需要在wxc-tabbar外面再套一层。

<template>
    <wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white"> 
      <div class="wrap">
        <web class="web" id="webview" src="http://implements.io/footprint" if="{{page.trips.shown}}"></web>  

        // stories                               
        <stories if="{{page.stories.shown}}" msg="{{page.stories.msg}}"></stories>

        // about
        <about if="{{page.about.shown}}"></about>

      </div>   

      <div style="flex-direction: column;">      
        <wxc-tabbar tab-items={{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>
      </div>                        
    </wxc-navpage>

</template>

<style>
  .wrap{      
      position: absolute; 
      top: 0; 
      left: 0; 
      right: 0; 
      bottom: 90;     
  }
  .web{
      position: absolute;       
      top: 0; 
      left: 0; 
      right: 0; 
      bottom: 0;          
  }
</style>

下面这样就不正常,你们处理一下吧:

<template>
    <wxc-navpage data-role="none" height={{nav.height}} background-color="#353644" title={{nav.title}} title-color="white"> 
      <div class="wrap">
        <web class="web" id="webview" src="http://implements.io/footprint" if="{{page.trips.shown}}"></web>  
      </div>   

      // stories                               
      <stories if="{{page.stories.shown}}" msg="{{page.stories.msg}}"></stories>

      // about
      <about if="{{page.about.shown}}"></about>

      <wxc-tabbar tab-items = {{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>  

    </wxc-navpage>      
</template>

<style>
  .wrap{
      width: 750; 
      position: absolute; 
      top: 0; 
      left: 0; 
      right: 0; 
      bottom: 0;    
  }
  .web{
      position: absolute; 
      top: 0; 
      left: 0; 
      right: 0; 
      bottom: 0; 
      margin-top: 0;  
      margin-bottom: 70;
  }
</style>

thonatos avatar Aug 17 '16 01:08 thonatos

@thonatos

问题

这个不是tabbar的bug,是书写的问题 webview 在tabbar 之前,表示tabbar在上面,tabbar的嵌入的content会覆盖webview,webview无法点击。 将tabbar放在< div > < / div > 这个容器的高度为0,tabbar的content的高度为0,虽然webview可以拖动,当时tabbar的内容是不能呈现的

现象

tabbar在前面现象截图 demo1 div 容器为高度为0现象截图 demo2

针对你的问题,下面的代码你可以参考下(调换 tabbar和webview的位置)

      <wxc-tabbar tab-items = {{tab.tabItems}} style="margin-top:16;margin-bottom:16;"></wxc-tabbar>  

......


<div class="wrap">
        <web class="web" id="webview" src="http://implements.io/footprint" if="{{page.trips.shown}}"></web>  
</div>

kfeagle avatar Sep 19 '16 07:09 kfeagle

@kfeagle

👌,O(∩_∩)O谢谢

最好有一个地方可以说明加z-index关系(可能我没找到...),解释的很详细,赞一个!

thonatos avatar Sep 24 '16 08:09 thonatos

This issue is resolved.

alext1981 avatar Oct 11 '16 03:10 alext1981