weex icon indicating copy to clipboard operation
weex copied to clipboard

[BUG] 如果样式采用绑定变量,改变变量后,旧的样式即使被去掉了,在新样式里边仍然生效

Open squirrelx opened this issue 10 years ago • 1 comments

比如:一个div我设置一个下边框width为1,颜色为红色,点击一个按钮后给div换成另外的样式,虽然新样式里边不涉及边框和颜色,但是老的样式仍然生效,并没有清理:

<template>
    <div class="div-{{lookstyle}}" style="border-bottom-color: {{bottomColor}};">
        <text class="text" onclick="onclickchange">change</text>
    </div>
</template>
<style>
    .div-one {
        height: 150;
        width: 150;
        border-bottom-width: 1;
         border-bottom-color: red;
    }
    .div-two {
        height: 200;
        width: 200;    
    }  
    .text {
        width: ;
        height: 25;
        font-size: 30;
    }
</style>
<script>
    module.exports = {
        data: {
            lookstyle: 'one',
        },
        methods: {
            onclickchange: function(e) {
                this.lookstyle = (this.lookstyle == 'one') ?  'two' : 'one';
            }
        }
    }
</script>

squirrelx avatar Aug 30 '16 09:08 squirrelx

在 issue #397 中已经提过这个问题了,在新版 JS Framework (0.15+) 已经解决, PR #953 。

Hanks10100 avatar Aug 30 '16 09:08 Hanks10100