فهرست منبع

短信及输入框组件测试完成

BF-202205051124\Administrator 3 سال پیش
والد
کامیت
8a30ac0e27
2فایلهای تغییر یافته به همراه17 افزوده شده و 17 حذف شده
  1. 3 14
      components/en-send/en-send.vue
  2. 14 3
      pages/index/index.vue

+ 3 - 14
components/en-send/en-send.vue

@@ -32,11 +32,11 @@ export default {
     },
     label: {
       type: String,
-      default: '标题'
+      default: '手机号'
     },
     placeholder: {
       type: String,
-      default: '请输入'
+      default: '请输入手机号码'
     },
     disabled: {
       default: false
@@ -79,24 +79,13 @@ export default {
     getCode(){
       if (this.inputValue === '') {
         uni.showToast({
-          'title': "请输入手机号码",
+          'title': "请输入"+this.label,
           'icon': 'error',
           'mask': true,
           'duration': 1500
         })
         return;
       }
-      let regPhone = /^(?:(?:\+|00)86)?1\d{10}$/;
-      if (!regPhone.test(this.inputValue)) {
-        uni.showToast({
-          'title': "手机号码错误",
-          'icon': 'error',
-          'mask': true,
-          'duration': 1500
-        })
-        return;
-      }
-      console.log('sadasdsa')
       this.$emit('getCode')
     },
     setCodeNum(){

+ 14 - 3
pages/index/index.vue

@@ -1,8 +1,7 @@
 <template>
 	<view class="box">
     <Nav title="首页"></Nav>
-    <enInput></enInput>
-    <enInput></enInput>
+    <enInput v-model="text" name="用户姓名"></enInput>
     <enSend v-model="phone" ref="enSendObj" @getCode="getCode"></enSend>
 	</view>
 </template>
@@ -17,15 +16,27 @@
 		},
 		data() {
 			return {
-        phone:'13900139001'
+        phone:'13900139001',
+        text:'asdsa',
 			}
 		},
+    watch:{
+		  'phone':function (){
+        console.log('new--------'+this.phone)
+      },
+      'text':function (){
+        console.log('new--------'+this.text)
+      }
+
+    },
+
 		mounted() {
 
 		},
 		methods: {
       getCode(){
         console.log('---------------------asdsa')
+        this.text='abc'
         this.$refs.enSendObj.setCodeNum()
       },