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

通过弹出层展示的 Json Viewer 无法复制所渲染的 Json 内容 #61

Closed
BoBo-Git opened this issue Nov 19, 2020 · 2 comments
Closed

Comments

@BoBo-Git
Copy link

首先,感谢作者开发的这个库,样式简洁,使用方便。下面是我遇到的问题描述:

需求:
通过按钮点击展示一个弹出层,弹出层里再通过 Props 或者 Http 请求获取要展示的 Json 数据。

问题:
弹出层弹出后,组件可以正常渲染展示数据,但是点击 Copy 并没有正常拷贝渲染出来的数据。

分析:
应该是 v-if 指令导致的 $refs 无法正常获取造成的 Bug。

解决方式:
结合了另一个库 vue-clipboard2,用 v-show 控制隐藏一个 textarea,把想要的数据用 JSON.stringify 处理后进行复制。(但复制出来的 Json 没有换行格式)

期望:
期望在这个库里能添加上弹出层展示也能正常复制的支持,谢谢。

@chenfengjw163
Copy link
Owner

v-if不会导致不能复制,是不是render组件后copyable没有设置,copyable需要在初次渲染时设置?

@chenfengjw163
Copy link
Owner

fixed +2.2.19

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

No branches or pull requests

2 participants