当前位置: 首页 > 工具软件 > Web-Return > 使用案例 >

uni-app web-view缩放

杜志
2023-12-01

摘录原文链接

代码记录
<template>
	<view>
		<web-view :src="goToUrl()" progress></web-view>
	</view>
</template>

<script>
	var wv; //计划创建的webview
	export default {
		components: {},
		data() {
			return {
			};
		},
		onLoad() {
			
		},

		onReady() {
			// #ifdef APP-PLUS
			var currentWebview = this.$mp.page.$getAppWebview() //获取当前页面的webview对象
			setTimeout(function() {
				wv = currentWebview.children()[0]
				wv.setStyle({
					scalable: true
				})
			}, 1000); //如果是页面初始化调用时,需要延时一下
			// #endif
		},

		methods: {
		goToUrl()
		}
	}
</script>

<style lang="scss">

</style>
 类似资料: