itpdm
itpdm
  • 发布:2019-10-18 11:22
  • 更新:2019-10-18 11:22
  • 阅读:567

页面传值数据不更新

分类:uni-app

onload 里面 变量打印正常 为什么变量不更新 lab1到lab5都不更新
<template>
<view >
<view class="titel" style="padding-top: 10px;">产品信息</view>
<view class="box ">
产品分类:<label>{{label1}}</label>
</view>
<view class="box">
故障分类:<label>{{label2}}</label>
</view>
<view class="box">
现象分类:<label>{{label3}}</label>
</view>
<view class="titel">问题描述</view>
<view class="box" >
<textarea value="" v-model="label4"
disabled='true' auto-height='true'/>
</view>
<view class="titel">问题解答</view>
<view class="box">
<textarea value="" v-model="label5"
disabled='true' auto-height='true'/>
</view>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-title">评分答疑</view>
<view>
<slider value="10" @change="sliderChange" min="1" max="10" show-value />
</view>
</view>
<view class="uni-padding-wrap uni-common-mt" style="padding-bottom: 10upx;">
<button type="primary" @click="tijiao" >提交评分</button>
</view>
</view>
</template>

<script>
//import Vue from 'Vue';
let __this;
export default {

    data() {  
        return {  
            label1:'1',  
            label2:'2',  
            label3:'3',  
            label4:'4',  
            label5:'5',  
        }  
    },  
    onLoad() {  
        __this=this;  
        //console.log("user" name.username);  
        //this.name=name.username;  
        uni.$on('xiangqing',function(data){    
                console.log('lab4:' __this.label4);  
                __this.label1=data.data.cpclass;  
                __this.label2=data.data.gzclass;  
                // this.label3=data.data.xxclass;  
                __this.label4=data.data.pojtext;  
                // this.label5=data.data.datext;  
                 //console.log('this:' JSON.stringify(this));  
                 console.log('__this1' __this.label1);  
                 console.log('__this2' __this.label2);  
                 // console.log(this.label3);  
                 console.log(__this.label4);  
                 // console.log(this.label5);  
                uni.showToast({  
                    icon:'none',  
                    title:'加载成功!',  
                })  
            })  
    },  
    onUnload(){  
        uni.$off('xiangqing',function(data){  
            console.log('移除 update 自定义事件');  
        })  
    },  
    methods: {  
         sliderChange(e) {  
                    console.log('value 发生变化:'   e.detail.value)  
            },  
        tijiao(){  
            uni.showToast({icon:'none',title:提交成功})  
        }  

    }  
}  

</script>

2019-10-18 11:22 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复