2***@qq.com
2***@qq.com
  • 发布:2018-08-28 11:37
  • 更新:2018-08-28 11:49
  • 阅读:901

【报Bug】this 赋值出现bug值有设置但是没有this对象没有更新

分类:uni-app

详细问题描述
[内容]我想在组件初始化时判断通过传入的参数值进行判断做一些更新操作但是判断的时候数据刷新不了
见附件图片

重现步骤
见附件图片onready里面

运行环境
[系统版本]win10
[浏览器版本]微信开发工具 最新
[IDE版本]最新
[mui版本]最新

附件
[代码片段]

<template name="search-component">  
    <view class="n_search">  
        <view class="n_search-content">  
            <view class="n_sl getcitytit" @tap="openPage" :data-getpage="'common/citylist?gettype='+gettype+'&frompage:'+frompage" :style="'background: url('+imgRoot+'ser_dowm.png) right center ;background-repeat:no-repeat ;'">  
        {{city}}  
            <view class="border-right"></view>   
            </view>  
            <form>  
                <view class="n_sltxt">  
                    <image class="n_sltxt-searchicon" :src="imgRoot+'ser_bg.png'" mode="widthFix"></image>  
                    <input type="text" @confirm="formconfirm" name="keyword" v-model="value" placeholder="搜索关键字" />  
                </view>   

            </form>  
        </view>  
    </view>  
</template>  

<script>  
    var config = require('../../base/config.js');  

    export default {  
        name: "search-component",  
        props: {  
            gettype: {  
                type: String,  
                default: ""  
            },  
            frompage: {  
                type: String,  
                default: ""  
            },  
            imgRoot: {  
                type: String,  
                default:config.imgRoot  
            },  
            city: {  
                type: String,   
                default:''  
            },  
            value:{  
                type: String,  
                default: ""  
            }  
        },  
        methods: {  
            openPage:function(){  
                console.log(2);  
            },  
            formconfirm:function(){  
                console.log(1);  
            }  
        },  
        onReady:function(){  
            let city='';  
            if(this.city== "" || this.city == undefined || this.city == null){  
                this.city=22;  
                console.log(this.city)  
                console.log(this)  
            }  
        }  
    }  
</script>  
<style>  
    @import "search-component.css";  
</style>

联系方式
[QQ]2636011055

2018-08-28 11:37 负责人:无 分享
已邀请:
2***@qq.com

2***@qq.com (作者)

将判断拿掉就可以更新数据

2***@qq.com

2***@qq.com (作者)

希望解决下这个未知原因,条件更新用的场景还是比较多的

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