• In the middle
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;Copy the code
  • input
<! Placeholder input hints --> <! -- via pagesetThe Data() method dynamically changes the input value --> <! Handle keyconfirmation events with bindConfirm listener --> <! Listen for out-of-focus events using the bindblur method --> <inputtype="number" confirm-type="done"  value="{{car_price}}" placeholder-style="color:#FF6000; margin-right:10rpx; font-size:28rpx;" placeholder="Please enter" class="car-price" bindconfirm="changeCarPrice" bindblur="changeCarPrice"/>Copy the code
  • Returns data from child pages to parent pages
Wx. navigateBack() var pages = getCurrentPages(); var currPage = pages[pages.length - 1]; Var prevPage = pages[page.length-2]; // Previous page <! Prevpage.setcarinfo ({prevPage.setcarinfo ({prevPage.setcarinfo);"car_model": e.currentTarget.dataset.car, 
  "car_price": 289000})Copy the code
  • Switch the TAB page
wx.switchTab({
  url: '.. /CMSpecialCar/CMSpecialCar',})Copy the code
  • Dynamically changing styles, such as font color, etc
<text style="color:{{text_color}}"> </text> <! This. SetData ({color:'#ffffff'
})Copy the code
  • Set the background for the entire page
<! Display: block; display: block; min-height: 100%; background-color:#EFEFF4;
}Copy the code
  • Setting the background image
<! To set the local image as the background image, convert the image to Base64 encoding. Or just use a picture address; background-size: contain; < span style= "max-width: 100%; clear: both; min-height: 1em"Background-image: URL (Base64 encoding of the image); background-size: contain;"<! --background-size:100% 100%; // Without maintaining aspect ratio, zoom the image so that the width and height of the image are completely stretched to fill --> <! --background-size:contain; // Keep the aspect ratio to scale the image so that the long side of the image is fully displayed. In other words, the image can be displayed completely. -- > <! --background-size:cover; // Keep the aspect ratio of the zoom image to make sure that only the short edges of the image are fully displayed. That is, the image is usually complete only in the horizontal or vertical direction, the other direction will be truncated. -->Copy the code
  • Using the template
<! -- WXSS file --> @import".. /CMTemplate/CMTTip.wxss"; <! -- WXML file --> <import SRC =".. /CMTemplate/CMTCalculateTop"/>
<template is="calculateTop" data="{{... top_item}}"></template>Copy the code
  • Update template data ‘ ‘data: {

    loan_item: {

    radio_index: 0,
    ratio_array: ['10%'.'20%'.'30%'],
    period_index: 2,
    period_array: ['1 years'.'two years'.'three years'],
    tail_index: 1,
    tail_array: ['0%'.'30%'].Copy the code

    }},

bindRatioChange: Function (e) {var that = this console.log(‘ downpay ratio :’, e.daile.value) that. SetData ({‘loan_item.radio_index’: e.detail.value, }) },

- Simple animationCopy the code

showCarModel: function () {



var animation = wx.createAnimation({

duration: 200,

timingFunction: “linear”,

delay: 0

})

var that = this

that.animation = animation



animation.translateX(300).step()



that.setData({

carListAnimation: animation.export(),

showModelStatus: true

})

setTimeout(function () {

animation.translateX(0).step()

that.setData({

carListAnimation: animation.export()

})

}.bind(that), 200)

},

- Pass object data between pagesCopy the code

let str=JSON.stringify(that.data.car); wx.navigateTo({ url: ‘.. /CMpreferenceCommit/CMpreferenceCommit’ + “? Car =” + STR,}) onLoad:function(options){var car= JSON.

- post requestCopy the code

wx.request({ url:url method: ‘POST’, header: { ‘content-type’: ‘Application /x-www-form-urlencoded’},// So that the POST request will put data values in Query String Parameters. data: { ‘userName’: that.userName, ‘userPhone’: that.userPhone, ‘whichPage’: that.data.whichPage }, Complete :function(res) {console.log(‘complete’,res.data) if(res.data.success) {wx.showtoast ({title: ‘submit successfully ‘,})}})

- Controls the number of decimal placesCopy the code

toFixed(2)

- Check whether it is a valid numberCopy the code

If (isNaN(new Number(monthlyAmount))) {wx.showtoast ({title: ‘monthlyAmount ‘,}) return false; } ` ` `