@input事件(實時監聽輸入)傳參問題


@input事件 ,當鍵盤輸入時,觸發input事件,event.detail = {value}

場景

@input事件想要傳遞一個參數到方法中 但是同時還要保留原來返回的event

解決方法:$event

@input="onKeyInput($event,123)"

運用

<view class="item" v-for="(item,index) in PickedList" :key="index">
	<view class="itemTop">
		<view class="left">
			<text>網點名稱:{{item.service_branch.company_name}}</text>
			<text>網點編號:{{item.service_branch.company_id}}</text>
			<!-- <text>規格:{{item.goods_spec.specs}}</text> -->
			<text>說明:{{item.goods_spec.description}}</text>
		</view>
		<view class="right">
			<view class="mainBox-model-countBox-modelinfo-count">
				<view class="margin-top" @click="operation(item,index,1)">-</view>
				<input class="mainBox-model-countBox-modelinfo-countInput" type="number" v-model.number="item.count < 0 ? 0 : item.count"
				 :disabled="false" @input="countInput($event,index)"/>
				<view class="margin-top" @click="operation(item,index,2)">+</view>
			</view>
		</view>
	</view>
	<view class="btns">
		<tui-button width="220rpx" height="84rpx" type="green " @click="Dayin(item.id,item.count,index)" :disabled="printBtnStatus">打印標簽</tui-button>
		<tui-button width="220rpx" height="84rpx" @click="edit(item.id,item.count,index)">確認修改</tui-button>
	</view>
</view>
// 輸入數字實時監聽
countInput(e,index){
	let _this = this;
	console.log(e.detail.value); //輸入的值
	console.log(index); //傳參
	_this.PickedList[index].count = e.detail.value;
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM