Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
488 views
in Technique[技术] by (71.8m points)

weex中使用vue语法无法动态切换样式

<template>
<div>
    <text @click="change" style="font-size:50px">click</text>

    <div>
            <text v-bind:class="{active: isActive}">class变换</text>
     </div>

</div>
</template>
<style>
.active{

background-color:red

}

</style>

<script>

export default {
  data:function() { return {
        isActive:true,
        }},
  
  methods:{
     change:function(){
    this.isActive=!this.isActive
     }
   }

}

在weex中动态切换样式,电脑游览器中预览有效果,但在手机playground中点击却没有反应,请问这是什么问题?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
 用:class="[lineStyle(courseClick)]" 

methods

lineStyle(isClick){
                if (isClick===true){
                    return 'tab-items-current'
                }else {
                    return 'class-tab-items'
                }
            }

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...