赞
踩
最小的考虑兼容iphone5,320×568,最大考虑兼容ipad,768×1024;
- // 引入组件
- import uView from "uview-ui";
- Vue.use(uView);
- Vue.config.productionTip = false;
- App.mpType = 'app'
- const app = new Vue({
- ...App
- })
- app.$mount()
- // 判断是否是平板
- uni.getSystemInfo({
- success: (res)=>{
- console.log("屏幕尺寸:", res.windowWidth, res.windowHeight)
- if(res.windowWidth <= 320){
- Vue.prototype.iphone5 = true
- }else if(res.windowWidth > 500){
- Vue.prototype.pad = true
- }else{
- Vue.prototype.iphone5 = false
- Vue.prototype.pad = false
- }
- }
- });
- <view class="item-content">
- <image class="photo" src="../../static/image/homePage/Frame(11).svg"></image>
- <view :class="[iphone5 ? 'item-text-min' : 'item-text' ]">实时监控</view>
- </view>
- <script>
- import tabBar from '@/components/tabbar/tabbar.vue'
- export default {
- data() {
- return {
- title: 'Hello',
- iphone5: this.iphone5
- }
- },
- }
- </script>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。