主要屬性:

效果圖:

ml:
<!--style的優先級比class高會覆蓋和class相同屬性--> <!--頭像--> <view style="display:flex;justify-content: center;"> <image style="width:130rpx;height:130rpx;border-radius:50%;margin-top:10%;" src="../../image/logo.jpg"> </image> </view> <!--這個是輸入框背景--> <view class="inputView"> <!--這個是輸入框--> <input class="input" type="number" placeholder="請輸入賬號" placeholder-style="color: gray" bindinput="listenerPhoneInput" /> </view> <view class="inputView"> <input class="input" password="true" placeholder="請輸入密碼" placeholder-style="color: gray" bindinput="listenerPasswordInput"/> </view> <!--登錄按鈕--> <button style="margin-left: 15rpx; margin-right: 15rpx; margin-top: 50rpx; border-radius: 40rpx" type="primary" bindtap="listenerLogin">登錄</button>
ss:
.input{ padding-left: 10px; height: 44px; } .inputView{ /*邊界:大小1px, 為固體,為綠色*/ border: 1px solid green; /*邊界角的弧度*/ border-radius: 30px; margin-left: 15px; margin-right: 15px; margin-top: 15px; }
js:
Page({ /** * 初始化數據 */ data:{ phone: '', password: '', }, /** * 監聽手機號輸入,並把輸入的值保存在data變量中 */ listenerPhoneInput: function(e) { console.log('Phone='+e.detail.value) this.data.phone = e.detail.value; }, /** * 監聽密碼輸入,並把輸入的值保存在data變量中 */ listenerPasswordInput: function(e) { console.log('Password='+e.detail.value) this.data.password = e.detail.value; }, /** * 監聽登錄按鈕,獲取保存在data變量中的值 */ listenerLogin: function() { //打印收入賬號和密碼 console.log('手機號為: ', this.data.phone); console.log('密碼為: ', this.data.password); }, })
