uniapp+vue3监听输入框内容watch

代码

<view class="searchBox">
	<view class="searchLeft">
		<wh-icon name="search" size="40"></wh-icon>
		<input type="text" placeholder="请输入搜索内容" v-model="search" />
	</view>
	<view class="searchBtn" @click="searchSchool">搜索</view>
</view>
import {
	ref,
	watch,
} from "vue";
const search = ref('') //搜索内容
watch(search, (newValue) => {
	if (!newValue) {
	    getSchoolLists()
	}
})
function searchSchool() {
	getSchoolLists()
}
.searchBox {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 80rpx;
	background: #f8f8f8;
	border-radius: 50rpx;
	padding: 0 20rpx;
	margin: 0 30rpx;

	.searchLeft {
		display: flex;
		align-items: center;
		width: 100%;

		input {
			text-align: left;
			font-size: 26rpx;
			border-radius: 0;
			margin-left: 10rpx;
			width: 70%;
		}
	}

	.searchBtn {
		font-size: 28rpx;
		color: #757575;
		flex-shrink: 0;
	}
}

相关推荐

  1. uniapp+vue3监听输入内容watch

    2024-04-20 19:54:03       13 阅读
  2. 【Vue3watch监听使用【超详细】

    2024-04-20 19:54:03       9 阅读
  3. Linux watch命令监视命令输出

    2024-04-20 19:54:03       47 阅读
  4. 【Vue3watch监听的五种情况

    2024-04-20 19:54:03       40 阅读
  5. vue3 实现 input 输入聚焦

    2024-04-20 19:54:03       24 阅读
  6. vue3 input输入输入限制(数字)

    2024-04-20 19:54:03       13 阅读
  7. 【VUE】watch 监听失效

    2024-04-20 19:54:03       38 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-20 19:54:03       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-20 19:54:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-20 19:54:03       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-20 19:54:03       20 阅读

热门阅读

  1. js,ts中简写符号大全

    2024-04-20 19:54:03       13 阅读
  2. uniapp小程序——长按识别二维码

    2024-04-20 19:54:03       12 阅读
  3. Ansible相关

    2024-04-20 19:54:03       13 阅读
  4. Python数据挖掘项目开发实战:大数据处理

    2024-04-20 19:54:03       13 阅读
  5. RTT学习

    2024-04-20 19:54:03       12 阅读
  6. 11篇 Es集群环境安装的步骤

    2024-04-20 19:54:03       10 阅读
  7. Spring-Aop源码解析(下)

    2024-04-20 19:54:03       13 阅读
  8. 前端-renren-ui学习

    2024-04-20 19:54:03       13 阅读
  9. 自动化运维工具Ansible模块的介绍与使用

    2024-04-20 19:54:03       12 阅读
  10. 作文笔记7 说明文说明方法

    2024-04-20 19:54:03       10 阅读