惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
H
Help Net Security
N
Netflix TechBlog - Medium
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
A
About on SuperTechFans
V
V2EX
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
博客园 - 【当耐特】
Microsoft Security Blog
Microsoft Security Blog
Martin Fowler
Martin Fowler
I
InfoQ
Google DeepMind News
Google DeepMind News
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
U
Unit 42
The Cloudflare Blog
Y
Y Combinator Blog

Surmon.me

一人有限集团 你就是不敢 创造力是温柔的谎言 人类正在退出人类 AI 代替不了这样的你 脉冲点火背后的架构设计 基于 Cloudflare 生态的 AI Agent 实现 NodePress 支持用户登录了 从统计学习到通用智能 2025 投资报告:走慢的路 无依之地 会杀人的菩萨 无我不是共识 文化的积重与偏见 当下即安 科学的尽头是态度 无我不是 Egoless 信仰不因恐惧而存在 世间无解的矛与盾 先别急着做些什么 佛不需要你的皈依 真理的幻觉 两扇大门 造心里的浮屠 自胜者强 逻辑与智慧 真的相 快乐的秘密 只需愿意 是名体验
极简的剪切板组件
Surmon · 2018-01-05 · via Surmon.me

原创

极简的剪切板组件

不再用 clipboard.js 了,所以:

        
        

123456

<!-- 这就是剪贴板载体,想办法视觉隐藏就可以 --> <input type="text" v-model="clipboardText" class="clipboard-input" ref="clipboard"> <button @click="copyToClipboard('123')"></button> <button @click="copyToClipboard('abc')"></button> <button @click="copyToClipboard('789')"></button>

        
        

1234

.clipboard-input { height: 0px; opacity: 0; }

        
        

123456789101112131415161718

export default { data() { return { clipboardText: '' } }, methods: { copyToClipboard(text) { console.log('要复制这个文本:', text) this.clipboardText = text // $nextTick 在这里没用 setTimeout(() => { this.$refs.clipboard.select() document.execCommand('Copy') }) } } }

好,完