Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Image): 暴露图片预览方法 #6479

Open
3 tasks done
Sonic853 opened this issue Oct 21, 2024 · 1 comment · May be fixed by #6488
Open
3 tasks done

feat(Image): 暴露图片预览方法 #6479

Sonic853 opened this issue Oct 21, 2024 · 1 comment · May be fixed by #6488
Labels
feature request New feature or request

Comments

@Sonic853
Copy link

Sonic853 commented Oct 21, 2024

问题的清晰而简明的描述

希望有一个预览方法,例如在点击一个按钮会触发点击 Image 的预览,但是 ImageInst 没有暴露。
或者拎出 ImagePreview 方法

建议的解决方案

<script setup lang="ts">
import type { ImageInst } from 'naive-ui'
const imageRef = ref<ImageInst | null>(null)

// 执行图片预览
imageRef.value.click()

</script>
<template>
  <n-image ref="imageRef" />
</template>

备选方案

<script setup lang="ts">
import { ImagePreview } from 'naive-ui'
import { renderToolbar } from 'Method'

// 工具栏更改
ImagePreview.renderToolbar = renderToolbar
// 预览图片
ImagePreview.preview("http://demo.com/demo.jpg")

</script>
<template>
</template>

附加上下文

No response

验证

  • 阅读 贡献指南
  • 阅读 文档
  • 检查是否已经存在请求相同功能的问题,以避免创建重复的问题。
@Sonic853 Sonic853 added the feature request New feature or request label Oct 21, 2024
Sonic853 added a commit to Sonic853/naive-ui that referenced this issue Oct 23, 2024
@Sonic853 Sonic853 linked a pull request Oct 23, 2024 that will close this issue
@799189288
Copy link

建议预览方法传入数组来支持多个图片预览, 并在预览的时候展示图片数量和当前图片位置

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants