baidu / baidu/amis

media card的图片怎么设置大小?

Open
#3,348 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 实现场景:
crud的card模式展示海报图,用多媒体card模式,由于海报图大小不一致,希望把缩略图统一设置成固定的240*300大小。

#### 存在的问题:
media card无法设置图片大小,所有图片全部原始大小展示,加上className也无效

#### 当前方案:
请粘贴你当前方案的完整 amis schema 代码...

```
"card": {
"className": "text-center",
"header": {
"title": "$title",
"subTitle": "$intro"

},
"media": {
"type": "image",
"className": "inline m-36", //设置inline是为了居中显示图片,实测inline可以覆盖原来的block属性达到居中显示效果。但width属性无法覆盖,F12看到的图片的属性仍然是auto展示原始大小。
"url": "$url",
"position": "top"
}
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the provided card.media schema and trace how the media card renders its image and applies className. Confirm how a fixed 240×300 thumbnail should be configured, then verify that differently sized poster images render consistently in the card mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.