lilei 4 tháng trước cách đây
mục cha
commit
154cda0d5e
2 tập tin đã thay đổi với 24 bổ sung6 xóa
  1. 6 0
      components/chunLei-popups/chunLei-popups.vue
  2. 18 6
      components/m-input.vue

+ 6 - 0
components/chunLei-popups/chunLei-popups.vue

@@ -39,6 +39,10 @@
 				type:Boolean,
 				default:false
 			},
+			modelValue:{
+				type:Boolean,
+				default:false
+			},
 			popData:{
 				type:Array,
 				default:()=>[]
@@ -74,11 +78,13 @@
 		methods:{
 			tapMask(){
 				this.$emit('input',!this.value)
+				this.$emit('update:modelValue',!this.value)
 			},
 			tapItem(item){
 				if(item.disabled) return
 				this.$emit('tapPopup',item)
 				this.$emit('input',!this.value)
+				this.$emit('update:modelValue',!this.value)
 			},
 			getStatusBar(){
 				let promise = new Promise((resolve,reject)=>{

+ 18 - 6
components/m-input.vue

@@ -1,13 +1,25 @@
 <template>
 	<view class="m-input-view">
-		<input :focus="focus" :type="inputType" :value="value" @input="onInput" class="m-input-input" :placeholder="placeholder"
-		 :password="type==='password'&&!showPassword" :maxlength="maxlength" @focus="onFocus" @blur="onBlur" />
+		<input 
+		:focus="focus" 
+		:type="inputType == 'password' ? 'text' : inputType"
+		:value="value" 
+		@input="onInput" 
+		class="m-input-input" 
+		:placeholder="placeholder"
+		 :password="type == 'password' && !showPassword"
+		 :maxlength="maxlength" 
+		 @focus="onFocus" 
+		 @blur="onBlur" />
 		<!-- 优先显示密码可见按钮 -->
 		<view v-if="clearable&&!displayable&&value.length" class="m-input-icon">
 			<uni-icons color="#666666" type="clear" @click="clear"></uni-icons>
 		</view>
 		<view v-if="displayable" class="m-input-icon">
-			<uni-icons :style="{color:showPassword?'#666666':'#cccccc'}" type="eye" @click="display"></uni-icons>
+			<uni-icons 
+			:style="{color:showPassword?'#666666':'#cccccc'}" 
+			type="eye"
+			@click.stop="showPassword = !showPassword"></uni-icons>
 		</view>
 	</view>
 </template>
@@ -23,6 +35,7 @@
 			 * 值
 			 */
 			value: String,
+			modelValue:String,
 			/**
 			 * 占位符
 			 */
@@ -78,9 +91,7 @@
 		methods: {
 			clear() {
 				this.$emit('input', '')
-			},
-			display() {
-				this.showPassword = !this.showPassword
+				this.$emit('update:modelValue','')
 			},
 			onFocus() {
 				this.isFocus = true
@@ -92,6 +103,7 @@
 			},
 			onInput(e) {
 				this.$emit('input', e.detail.value)
+				this.$emit('update:modelValue',e.detail.value)
 			}
 		}
 	}