Tencent / Tencent/tdesign-miniprogram

[Grid 宫格] 使用grid组件,小程序开发工具和mac电脑真机预览没有问题,但是使用iphone13真机预览宫格的图片没有缩小

Open
#3,012 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Skyline
Dominant language
Vue
Stars
1.8k
Forks
337
Avg merge
1d 21h
Merged PRs (30d)
19

Description

tdesign-miniprogram 版本

1.5.0

重现链接

No response

重现步骤

我为我的项目开启了深色模式,我不知道是不是深色模式导致的,我在首页引入了Grid 组件,我的wxml文件如下:

<!--index.wxml-->
<navigation-bar title="我的海滨" back="{{false}}" color="black" background="#FFF"></navigation-bar>
<t-swiper
  style="--td-swiper-radius:0rpx"
  current="{{current}}"
  autoplay="{{autoplay}}"
  duration="{{duration}}"
  interval="{{interval}}"
  navigation="{{navigation}}"
  paginationPosition="{{paginationPosition}}"
  list="{{swiperList}}"
>
</t-swiper>
<view>
  <t-grid class="block" column="{{4}}" theme="card">
  <t-grid-item text="标题文字" image="{{img1}}" />
  <t-grid-item text="标题文字" image="{{img2}}" />
  <t-grid-item text="标题文字" image="{{img3}}" />
  <t-grid-item text="最多五个字" image="{{img1}}" />
  <t-grid-item text="标题文字" image="{{img1}}" />
  <t-grid-item text="标题文字" image="{{img3}}" />
  <t-grid-item text="标题文字" image="{{img2}}" />
  <t-grid-item text="最多五个字" image="{{img2}}" />
</t-grid>
</view>

wxss文件如下:

/**index.wxss**/
.img {
  width: 100%;
  height: 100%;
}
.block {
  display: block;
  margin-top: 20rpx;
}

JSON文件如下:

{
  "component": true,
  "usingComponents": {
    "navigation-bar": "/components/navigation-bar/navigation-bar",
    "t-swiper": "tdesign-miniprogram/swiper/swiper",
    "t-grid": "tdesign-miniprogram/grid/grid",
    "t-grid-item": "tdesign-miniprogram/grid-item/grid-item"
  }
}

js文件如下:

// index.js
const app = getApp();

const imageCdn = 'https://tdesign.gtimg.com/mobile/demos';
const swiperList = [
  `${imageCdn}/swiper1.png`,
  `${imageCdn}/swiper2.png`,
  `${imageCdn}/swiper1.png`,
  `${imageCdn}/swiper2.png`,
  `${imageCdn}/swiper1.png`,
];
Page({
	data: {
		current: 2,
    autoplay: true,
    duration: 500,
    interval: 5000,
    paginationPosition: 'bottom-right',
    swiperList,
		navigation: { type: 'fraction' },
		swiperHeigh: '',
    img1: 'https://biyesheji0601.oss-cn-beijing.aliyuncs.com/haibin/kebiao.png',
		// img1: 'https://tdesign.gtimg.com/mobile/demos/example1.png',
    img2: 'https://tdesign.gtimg.com/mobile/demos/example2.png',
    img3: 'https://tdesign.gtimg.com/mobile/demos/example3.png',
	},
	  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
		this.getTabBarPage()
		this.getSwiperHeigh()
  },
	/**
	 * 生命周期函数--监听页面卸载
	 */
	onUnload() {
	
	},
	/**
	 * tabbar跳转
	 */
	getTabBarPage() {
		if (typeof this.getTabBar === 'function' && this.getTabBar()) {
			const page = getCurrentPages().pop();
			this.getTabBar().setData({
				value: '/' + page.route
			})
		}
	},
	/**
	 * 计算轮播图的高度,按照黄金比例计算
	 */
	getSwiperHeigh() {
		console.log("设置轮播图的高")
		this.setData({
			swiperHeigh : app.globalData.phoneWidth * 0.618 * (750 / app.globalData.phoneWidth) 
		})
		console.log(this.data.swiperHeigh)
	}
})

问题截图如下:
IMG_2915

开发工具截图如下

期望结果

我希望它能和我开发工具展示的保持一致,图标完美展示

实际结果

No response

基础库版本

No response

补充说明

我是一个后端开发,如果提出的问题很简单就解决了,跪求大佬不要diss我

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue on an iPhone 13 with the provided index.wxml, index.wxss, JSON, and JavaScript setup, comparing it with the development tools preview. Then inspect the t-grid and t-grid-item component implementation for platform-specific image sizing behavior. Done means the grid images have the same intended size and appearance on the iPhone and in the development tools.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.