uniapp清空文本框内容
文章描述:
uniapp点击提交按钮后清空文本框里面的内容?
template
<template>
<view class="content">
<view class="input">
<input type="text" v-model="text" placeholder="请输入内容!"/>
</view>
<view>
<button @click="postBotton">发送</button>
</view>
</view>
</template>
script
var _self;
export default{
data(){
return{
text:''
}
},
onLoad() {
_self = this;
},
methods:{
postBotton(){
console.log(this.text);
setTimeout(function(e){
_self.text = '';
},1500);
}
}
}
style
.content{
padding: 17upx 34upx;
}
.input{
width: 100%;
border:1upx solid #eee;
margin-bottom: 20upx;
padding: 17upx 0;
}
input{
padding-left: 20upx;
}
发布时间:2021/10/14
发表评论