当前位置:网站首页>Comparison between WeChat applet and Alipay applet

Comparison between WeChat applet and Alipay applet

2020-12-07 17:40:31 miomiomio

Comparison between WeChat applet and Alipay applet

Get custom component syntax comparison

The custom component syntax of Alipay and WeChat is almost the same. , When we develop a component , When referenced in the actual page , An instance of the component needs to be obtained .

  1. Alipay gets custom component instances :

        <cxloading ref='saveLoading' /> 
        saveLoading(ref){this.cxLoading = ref;}
        // Alipay components need to be acquired by methods. 
  2. Getting custom components from wechat :

        <cxLoading id='cxLoading'></cxLoading>
        this.cxLoading = this.selectComponent("#cxLoading");
        // Wechat custom components can be accessed through id obtain DOM

Comparison of communication syntax between parent and child components

  1. Alipay son father :(on start )

         Son :this.props.onRefreshFlight("aaa");
         Father :<cxmodal ref='saveModal' onRefreshFlight="bbb">
  2. Wechat son to father :(triggerEvent Trigger )

         Son :this.triggerEvent("refreshFlight","aaa");
         Father :<cxmodal id='cxmodal' bind:refreshFlight="bbb">
  3. Alipay father biography :( For sub components this.props obtain )

         Father :<cxmodal flight_date='{{currentFlight.flight_date}}'>
         Son :this.props.flight_date
  4. Wechat father to son :( Direct access to )

         Father :<cxmodal flight_date='{{currentFlight.flight_date}}'>
         Son :this.data.flight_date

Alipay development tools difference

  1. Related applications : Select the details to associate with the current application , Otherwise, it cannot be authorized
  2. When using custom components , Development tools need to be selected component2 compile
  3. Using Alipay to develop cloud needs , Opening severless service , Create a cloud service space , Create cloud resources and IDE Middle Association Serverless
  4. Wechat cloud development can use cloud development by selecting cloud development mode when creating applications

More commonly used js

  1. Filter unique value / duplicate removal , And generate a new array

        var a = [1,1,2,3]
        var b = [...new Set(a)]
  2. format json

        JSON.stringify({},null,'\t')
  3. String array to integer array ["1","2","3"]===>[1,2,3]

        arr = arr.map(Number)
        // Be careful : Be sure to reassign , because map The new array is returned ,forEach The original array will be modified 

版权声明
本文为[miomiomio]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207173942573t.html