Skip to content

scroll组件内的文字在浏览器中无法选中复制。 #235

@Zacccccc

Description

@Zacccccc

您好,
vue2 + better-scroll0.2.4,scroll组件中p标签内的文字,无法再pc浏览器复制、无法在手机长按选取及复制。
请问是否有办法解决这个问题呢?
scroll组件外的文字,在页面中可以复制。
css添加user-select:text/all; 也没有效果

Activity

ustbhuangyi

ustbhuangyi commented on Sep 18, 2017

@ustbhuangyi
Owner

请移步最新版的 better-scroll,并参考文档:https://ustbhuangyi.github.io/better-scroll/doc/options.html#preventdefaultexception

duanxb

duanxb commented on Nov 12, 2018

@duanxb

请移步最新版的 better-scroll,并参考文档:https://ustbhuangyi.github.io/better-scroll/doc/options.html#preventdefaultexception

你好,添加上这个属性preventdefaultexception后,可以复制了,但是当 scroll 刷新重新计算refresh()的时候,则又无法长按复制了。

qinouz

qinouz commented on Jan 14, 2019

@qinouz

请移步最新版的 better-scroll,并参考文档:https://ustbhuangyi.github.io/better-scroll/doc/options.html#preventdefaultexception

你好,添加上这个属性preventdefaultexception后,可以复制了,但是当 scroll 刷新重新计算refresh()的时候,则又无法长按复制了。

请问解决了么 我现在页遇到这个问题了

11003

11003 commented on Nov 23, 2022

@11003

解决方法:

const classIgnore = '需要被选择的class类名'
const tagException = {
  className:new RegExp(classIgnore,"i"),
  tagName:/textarea/i
}
new BScroll(".wrapper",{
  tagException:tagException
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @ustbhuangyi@duanxb@Zacccccc@qinouz@11003

        Issue actions

          scroll组件内的文字在浏览器中无法选中复制。 · Issue #235 · ustbhuangyi/better-scroll