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

内容为字符串时复制问题 #119

Open
BayMax619 opened this issue Jun 21, 2024 · 0 comments
Open

内容为字符串时复制问题 #119

BayMax619 opened this issue Jun 21, 2024 · 0 comments

Comments

@BayMax619
Copy link

  const clipBoard = new Clipboard(this.$refs.clip, {
    container: this.$refs.viewer,
    text: () => {
      return JSON.stringify(this.value, null, 2)
    }
  });

value如果是字符串不需要JSON.stringify

  const clipBoard = new Clipboard(this.$refs.clip, {
    container: this.$refs.viewer,
    text: () => {
      if (typeof this.value === 'string') {
        return this.value;
      }
      return JSON.stringify(this.value, null, 2)
    }
  });
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

1 participant