Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append=tree 的bug #1148

Closed
haicuan139 opened this issue Sep 6, 2016 · 7 comments
Closed

append=tree 的bug #1148

haicuan139 opened this issue Sep 6, 2016 · 7 comments
Assignees

Comments

@haicuan139
Copy link

haicuan139 commented Sep 6, 2016

下面这段代码不能响应 text 的点击事件。

<template>
    <list append='tree'>
       <cell style="background-color: #0000cc">
           <text onclick="onclick">AAAAAAAAAA</text>
       </cell>
    </list>
</template>
methods:{
            onclick:function(e){
                console.log(e);
            },
@Hanks10100
Copy link
Member

Hanks10100 commented Sep 6, 2016

根元素上不能用 append="tree" 指令,这是已知特性。在 <list> 外层套一个 <div> 就可以了。

@Jinjiang
Copy link
Contributor

Jinjiang commented Sep 7, 2016

应该和 append="tree" 没有直接关系
@haicuan139 可否提供更完整的代码,可以让我们帮你做进一步排查?或者检查一下是否别的地方写法有问题导致不能点击
谢谢

@haicuan139
Copy link
Author

haicuan139 commented Sep 7, 2016

@Jinjiang

将list元素换成scroller 也是一样的,不能触发点击事件,如果是特性的话那就没什么问题了:

<template>
    <list append="tree">
       <cell onclick="onclick" style="background-color: #0000cc">
           <text onclick="onclick">AddAAAAAAAAA</text>
       </cell>
    </list>
</template>
<script>
    require('weex-components');
    module.exports = {
        data: {
            showHot:true
        }
        , methods:{
            onclick:function(e){
                console.log(e);
            }
        },
        created: function () {
        }
    }
</script>

@Jinjiang
Copy link
Contributor

Jinjiang commented Sep 7, 2016

got 重现了,我们当 bug 修复一下
谢谢

@haicuan139
Copy link
Author

@Jinjiang 我刚刚也测试了下,div 根元素 也是不行的。我觉得像Hanks10100 所说的,根试图目前应该不能添加 append = tree 的属性

@Jinjiang
Copy link
Contributor

Jinjiang commented Sep 8, 2016

@boboning

从有 append="tree" 和没有两种情况下,我通过 iOS Playground 收集到的 taskArray:

没有 append="tree",可以正常点击工作

共两次 taskArray

(
{
    args =     (
                {
            attr =             {
            };
            ref = "_root";
            style =             {
            };
            type = div;
        }
    );
    method = createBody;
    module = dom;
}
)

第二个 taskArray

(
{
    args =     (
        "_root",
                {
            attr =             {
                value = 1;
            };
            event =             (
                click
            );
            ref = 11;
            style =             {
            };
            type = text;
        },
        "-1"
    );
    method = addElement;
    module = dom;
}
)

append="tree",不可点击

(
{
    args =     (
                {
            attr =             {
                append = tree;
            };
            ref = "_root";
            style =             {
            };
            type = div;
        }
    );
    method = createBody;
    module = dom;
},
{
    args =     (
        "_root",
                {
            attr =             {
                value = 1;
            };
            event =             (
                click
            );
            ref = 8;
            style =             {
            };
            type = text;
        },
        "-1"
    );
    method = addElement;
    module = dom;
}
)

@Jinjiang Jinjiang assigned boboning and unassigned boboning Sep 8, 2016
@Jinjiang
Copy link
Contributor

Jinjiang commented Sep 8, 2016

#1173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants