如何在社区页面的弹出窗口中预览文件LWC Salesforce
我一直坚持这些问题,并且不知道如何解决该问题,因此我知道标准库,例如“ navigationmixin”,用于文件预览无法在社区页面中正确工作,因此我
const docId = 'testcontdocid'
this[NavigationMixin.Navigate]({
type: 'standard__namedPage',
attributes: {
pageName: 'filePreview'
},
state : {
selectedRecordId: docId
}
})
无论如何代码都无法正常工作。找到了一个解决方案,它可以在“ content -Distribution”对象中创建相应的记录,并且在ContentDistribution上的DistributionPublicurl字段自动填充。然后,我可以使用类似的东西:
this[NavigationMixin.Navigate]({
type: 'standard__webPage',
attributes: {
url: DistributionPublicUrl
}
});
它可以完美地工作,但是在新的浏览器窗口中打开文件,而不是在弹出窗口中打开文件。有人知道如何解决吗?提前致谢。顺便说一下我使用LWC
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这对我有用,并在社区中展示了预览,并在弹出窗口中所希望的:
This worked for me and displayed the preview, in the community, in the pop-up as wished:
它正在显示弹出
It's showing pop up
在社区中,它将在新窗口中打开
中弹出的方法
对于此代码,我没有找到与内部salesforce org中显示的同一窗口 社区
In the community it will openup in a new window
for this code and i didnt find a way to pop-up in the same window as it shows in the internal salesforce org :(
and this below approaches we take us to the detail page of contentDocument in the new tab when we try to open in community
我在社区页面上遇到了类似的问题。而不是使用导航米克林,请尝试使用 Lightning-Modal 组件。
该组件有助于在同一窗口中生成弹出窗口。
参考:
I had faced similar issue with community page. Instead of using NavigationMixin, please try using Lightning-Modal component.
This component helps in generating a pop up in same window.
Refer: https://developer.salesforce.com/docs/component-library/bundle/lightning-modal/documentation