跳转到内容
View in the app

A better way to browse. Learn more.

彼岸论坛

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
欢迎抵达彼岸 彼岸花开 此处谁在 -彼岸论坛

[程序员] 小程序开发求助,如何实现这个需求

发表于

做一个类似于文档浏览器的组件,服务端提前把 Word 、PDF 、EPUB 、TXT 等不同格式的文档转换为标准的 HTML 字符串,HTML 中包含 img 标签,我的话使用 rich-text 组件可以实现基本的浏览,可以用 WXSS 调整字体和图片宽高。

现在我希望实现,长按选中文本,然后监听到选中后,在选中的位置悬浮工具栏,包括划线、复制、分享、词典这些,就和看书阅读软件那样子。

大佬们有没有好的方案给小弟我参考参考。

目前已知 WPS 和腾讯文档的文档阅读器,都是直接嵌入了 WebView ,并不是使用小程序的原生能力实现的,大概能猜到,是小程序能做的功能实在有限。

现在的话,我用 rich-text 能实现基本的阅读和选中复制,但是无法监听到选中并弹出工具栏。

Featured Replies

No posts to show

创建帐户或登录来提出意见

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.