当前位置:网站首页>微信小程序bindinput和点击按钮赋值当前文本的内容
微信小程序bindinput和点击按钮赋值当前文本的内容
2022-07-19 06:26:00 【这次我一定要赢】
一.在输入框里面获取实时输入的值
代码:
<input type="text" placeholder="请输入关键字" bindinput="bindKeyInput" />
bindKeyInput(e) {
const value = e.detail.value
}
获取实时输入到input框里面的值。
二.一键赋值文本内容
要复制的文本内容:
data: {
lianjie: "谢谢谢谢谢寻寻寻寻寻寻寻寻寻"
},
<view class="textContent">{
{lianjie}} </view>
绑定点击事件:
<view class="textTwo" bindtap="copy">一键复制</view>
copy: function (event) {
// var wxChat = event.currentTarget.dataset.wechatid //接收wxml传过来的数据
wx.showToast({
title: '复制成功',
})
// 下方为微信开发文档中的复制 API
wx.setClipboardData({
data: this.data.address, //复制的数据
success: function (res) {
wx.getClipboardData({
success: function (res) {
console.log(res.data) //打印赋值的数据
}
})
}
})
},
从而实现复制的文本内容。
三.总结
绑定bindinput事件获取实时的输入框值。
通过这个api实现赋值:
具体可见官方文档
边栏推荐
- Pikachu shooting range SQL injection digital injection (post) clearance steps
- 亲测 运营版 在线考试 online_testck163 2.7.18功能强大的在线考试模块
- Chapter 3 business function development (delete the remarks of market activities)
- C language Standard formatted input and output
- oracle触发器sql错误
- New features and community progress of impala 3.4
- 11day
- JS timer and swiper plug-in
- H5引入Web调试工具、VConsole引入
- Resolution of PIP installation dependency failure
猜你喜欢
随机推荐
二叉树的链式存储结构
Impala元数据简介
MySQL手动注入步骤
Resolution of PIP installation dependency failure
Flink内核源码(六)状态容错与两阶段提交
关于风机滑环的寿命以及工作原理
[vector space]
如何将数据从客户端通过copy命令导入优炫数据库
[yunyuansheng boy rushes into the Ninth Heaven of IVX platform] 1: project creation of actual ivx-0 code programming experience
Pikachu shooting range SQL injection character injection (get) clearance steps
Pikachu靶场-SQL注入-字符型注入(get)过关步骤
《论文复现》BiDAF代码实现过程(1)数据处理
Comparator sorted pit
盒模型再回顾:外边距折叠原理与BFC的关系
HCIP-DHCP snooping
类型详解(枚举+联合)
折半插入排序,加一个条件判断会得到优化吗?
How to search issue in Apache JIRA
DateTimePicker设置默认的时间范围,超过范围则不可选
jmeter项目实战:beanshell对获取结果进行处理64base处理