HTML块

<input type="text" placeholder="输入你要搜索的内容" class="inputs" confirm-type="search" @confirm="inputConfirm"
					@input="onKeyInput" placeholder-style='color:#a5c4c7'>
				<image src="../../static/images/search.png" mode="" @click="search"></image>

JS块

methods: {
			// 回车键确定
			inputConfirm(event) {
				// 确定之后跳转到哪里
				console.log(event.detail.value)
			},
			//边输入边触发 得到文本框的值
			onKeyInput(event) {
				// 把值赋给data中的变量
				console.log(event.target.value)
			},
			//点击搜索图标 跳转页面
			search() {
				// 获取data中的变量,跳转页面
			}
		}

搜索获取值,页面跳转

Logo

技术共进,成长同行——讯飞AI开发者社区

更多推荐