nvueTest.nvue 793 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
<template>
	<div>
    <text>宽:{{width}},高:{{height}}</text>
		<button @tap="getSystemInfoClick">getSystemInfo测试</button>
	</div>
</template>

<script>
	export default {
    data:{
      width:"",
      height:""
    },
		onLoad() {
		  console.log("onload")
		},
    methods:{
      getSystemInfoClick:function(){
        
        console.log("getSystemInfoClick")
          try {
            let systemInfo = uni.getSystemInfoSync()
            this.height = systemInfo.screenHeight
            this.width = systemInfo.screenWidth
            
            console.log("globalScreenHeight",this.height,"globalScreenWidth",this.width)
          } catch (e) {
            // 兼容本地测试
            console.error(e)
          }

      }
    }
	}
</script>

<style>

</style>