naive-ui icon indicating copy to clipboard operation
naive-ui copied to clipboard

`<n-image>` aspect ratio

Open TxzK opened this issue 2 years ago • 1 comments

This function solves the problem (这个功能解决的问题)

Support aspect-ratio prop on <n-image> so the height or width can be set automatically.

Expected API (期望的 API)

<n-image src="..." width="100%" aspect-ratio="16 / 9" />

TxzK avatar Aug 15 '22 12:08 TxzK

you can use:

  <n-image
    :img-props="{ style: { 'aspect-ratio': '16 / 9' } }"
    width="100"
    src="blablabla"
    fallback-src="https://07akioni.oss-cn-beijing.aliyuncs.com/07akioni.jpeg"
  />

https://codesandbox.io/s/elated-alex-wze3ug?file=/src/Demo.vue

OrbisK avatar Aug 15 '22 16:08 OrbisK

This issue does not have any recent activity. If you are still experiencing similar problems, open a new error, including a minimal copy of the problem

jahnli avatar Mar 12 '24 13:03 jahnli