Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

引用微信插件后,会导致数组更新不会渲染页面 #694

Closed
xiaofuliang opened this issue Aug 19, 2019 · 3 comments
Closed

引用微信插件后,会导致数组更新不会渲染页面 #694

xiaofuliang opened this issue Aug 19, 2019 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@xiaofuliang
Copy link

xiaofuliang commented Aug 19, 2019

问题描述
在manifest.json配置文件里面引入了微信插件,会导致对数组进行操作时,页面上不会更新渲染。如果将这插件配置去掉,则可以正常渲染,但是这时会导致插件无法使用

复现步骤
mainifest.json 添加 plugins
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
},
"usingComponents": true,
"plugins": {
"ocr-plugin": {
"version": "2.0.2",
"provider": "wx4418e3e031e551be"
}
}
},

page.vue


		<view class="cu-bar bg-white margin-top">
			<view class="action">
				验收照片
			</view>
			<view class="action">
				{{form.imgList.length}}/9
			</view>
		</view>
		<view class="cu-form-group">
			<view class="grid col-4 grid-square flex-sub">
				<view class="bg-img" v-for="(item,index) in form.imgList" :key="index" @tap="ViewImage" :data-url="form.imgList[index]">
					<image :src="item" mode="aspectFill"></image>
					<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
						<text class='cuIcon-close'></text>
					</view>
				</view>
				<view class="solids" @tap="ChooseImage" v-if="form.imgList.length<9">
					<text class='cuIcon-cameraadd'></text>
				</view>
			</view>
		</view>
		

	</form>
</view>
<script> export default { data() { return { form: { imgList: [] }, }; }, onLoad(option) { }, methods: { ChooseImage() { let imgSize = this.form.imgList.length; uni.chooseImage({ count: 9 - imgSize, //默认9 sizeType: ['original', 'compressed'], success: (res) => { if (this.form.imgList.length != 0) { this.form.imgList = this.form.imgList.concat(res.tempFilePaths) } else { this.form.imgList = res.tempFilePaths } } }); }, ViewImage(e) { uni.previewImage({ urls: this.form.imgList, current: e.currentTarget.dataset.url }); }, DelImg(e) { uni.showModal({ title: '提示', content: '确认要删除吗?', cancelText: '取消', confirmText: '确认', success: res => { if (res.confirm) { this.form.imgList.splice(e.currentTarget.dataset.index, 1) } } }) }, } } </script>

预期结果
上面代码对图片进行删除操作时,页面上能移除掉
实际结果
对数组进行splice操作时,页面上没有渲染,实际上数组里面的数据已经删掉了

@ly15927086342
Copy link

没错!我添加的插件是 route-plan (腾讯位置服务路线规划),前几天一直用的是预览模式,没发现问题,昨天试了下真机调试,发现数组不会自动渲染,必须点击一下屏幕才会渲染出来。
刚看到你的这个问题,我试了下把插件移除,结果在真机调试模式下运行正常!我还试了下是不是插件版本问题,改成旧版的发现依然存在这个问题。
另外,我发现添加插件后,watch无法监听数组变化了,但是移除插件之后就可以!
我的issue是#691,请uniapp的开发者帮忙解决下这个问题!

@fxy060608 fxy060608 self-assigned this Aug 20, 2019
@fxy060608 fxy060608 added the bug Something isn't working label Aug 20, 2019
@ly15927086342
Copy link

请问这个问题解决了吗?

@Wangyaqi
Copy link
Contributor

cli或者最新的alpha版已经解决这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants