data里面的数据更新了,uni-app模板视图获取不到新的值

data里面的数据更新了,uni-app模板视图获取不到新的值

项目信息 详情
产品分类 uniapp/小程序/微信
PC开发环境操作系统 Mac
PC开发环境操作系统版本号 13.4 (22F66)
HBuilderX类型 正式
HBuilderX版本号 4.24
第三方开发者工具版本号 4.57
基础库版本号 3.7.11
项目创建方式 HBuilderX

示例代码:

<template>  
<view class="bg-white" style="width: 100vw;height: 100vh;z-index: 999;">  
<view class="cu-bar bg-cyan search" style="height: 52px;">  <!--搜索栏-->  
<view class="search-form radius">  
<uni-easyinput v-model="keyword"  
ref="searchInput"  
[@focus](/user/focus)="inputFocus"  
[@blur](/user/blur)="inputBlur"  
confirmType="search"  
inputBorder="false" :styles="{width: '100%', height: '100%'}"
placeholder="搜索行程地点名称" [@confirm](/user/confirm)="handleSearch">&lt;/uni-easyinput&gt;
</view>
<view class="action">
<view class="row-between">
<view class="" [@click](/user/click)="handleSearch(keyword)">
<text class="cuIcon-search line-white"></text>
<text class="text-df text-white">搜索</text>
</view>
<view class="margin-left" [@click](/user/click)="cancelSearch">
<text class="text-df">取消</text>
</view>
</view>
</view>
</view>  

<view class="" v-if="searchResult.list"> <!--搜索结果-->
{{searchResult.list.length}}
<scroll-view scroll-y="true" style="max-height: calc(100vh - 52px);" class="">
<u-cell-group>
<u-cell :arrow="false" :isLink="true" v-for="item in searchResult.list" :key="item.id" [@click](/user/click)="onSelect(item)">
<view slot="title" class="flex justify-start align-center">
<view class=".cuIcon-location"/>
<um-texthighlight class="margin-left-xs text-df" :text="item.name" :keyword="keyword" color="blue"/>
</view>
<view slot="label" class="text-grey text-sm">
<view class="row-start margin-top-xs">
<text class="margin-left-lg">{{ item.pname }}</text>
<text class="margin-left-sm">{{ item.cityname }}</text>
<text class="margin-left-sm">{{ item.adname }}</text>
</view>
<view class="row-start margin-top-xs">
<view class="margin-left-lg">{{ item.address }}</view>
</view>
</view>
<view slot="right-icon">
<text class="text-grey text-sm" [@click](/user/click).stop="collectLocation(item)" v-show="!inCollect(item)">收藏地址
</text>
</view>
</u-cell>
</u-cell-group>
</scroll-view>
</view>  

<view class="" v-show="collect.show">
<view class="padding-sm">
<text class="text-black text-df">收藏过的地址</text>
</view>
<scroll-view scroll-y="true" style="height: calc(100vh - 92px);max-height: calc(100vh - 92px);" class="">
<u-cell-group>
<u-cell :arrow="false" :isLink="true" v-for="(item, index) in collect.list" [@click](/user/click)="onSelect(item)">
<view slot="title" class="flex justify-start align-center">
<view class=".cuIcon-location"/>
<um-texthighlight class="margin-left-xs text-df" :text="item.name" :keyword="keyword" color="blue"/>
</view>
<view slot="label" class="text-grey text-sm">
<view class="row-start margin-top-xs">
<text class="margin-left-lg">{{ item.pname }}</text>
<text class="margin-left-sm">{{ item.cityname }}</text>
<text class="margin-left-sm">{{ item.adname }}</text>
</view>
<view class="row-start margin-top-xs">
<view class="margin-left-lg">{{ item.address }}</view>
</view>
</view>
<view slot="right-icon">
<text class="text-grey text-sm" [@click](/user/click).stop="unCollectLocation(index)">取消收藏</text>
</view>
</u-cell>
</u-cell-group>
</scroll-view>
</view>  
</view>

更多关于data里面的数据更新了,uni-app模板视图获取不到新的值的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于data里面的数据更新了,uni-app模板视图获取不到新的值的实战教程也可以访问 https://www.itying.com/category-93-b0.html


如果是微信小程序模拟器内功能是正常显示的,就是真机不行。这个不应该,那需要排除一下环境问题。
你删减页面结构,只保留问题组件。你现在提供的源码内容太多,而且没有提供相对路径的逻辑,我无法直接运行测试。

回到顶部