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