[solved] mpvue has a set of code for multi-terminal reuse, how can Mini Program tags and interfaces be efficiently compatible?

Business background

during this period of time, I wrote a Mini Program with mpvue .
now I need to convert it to an official account
. I encountered more detailed problems in the process of conversion
, mainly the

on Mini Program"s special tag and Mini Program interface.
  • tag

    • swiper and other tags are used in Mini Program. Webpack cannot compile
    .
  • Interface

    • uses the interface at the beginning of wx , which always reports an error when you open the browser to debug, because the browser environment does not have wx object

perplexed

  1. now you must change all swiper and other Mini Program tags to h5 . If there are more places, it will be more troublesome
  2. . The
  3. interface is the same. It is troublesome to change too many interfaces. For example, wx.showToast is useful in many places. I have to find it one by one and modify it to the corresponding h5 mode
  4. .

question

is there a plug-in that is compatible with flyio compatible requests? is there a plug-in that is compatible with the Mini Program tag and Mini Program interface?
or is there a more efficient way to resolve this conflict?

solve

it"s almost a year since June 29, 2019. uni-app encapsulates styles and interfaces. Small projects can be fully satisfied.

it is July 12, 2018. So far, the mpvue community has no relevant external plug-ins or components to solve this problem.

  • Interface handling

at present, I have written a middle layer by myself. Export wx variables, and refer to different wx variables in different environments. Mini Program environment calls Mini Program"s interface, and in h5 environment, it is encapsulated with mint-ui . The exposed method name can be rewritten exactly like Mini Program"s

.
  • tag handling

try not to use Mini Program special tags, but directly rewrite the components of mint-ui , which are common to both ends

.
Mar.25,2021

see Lou Zhu ~! ~

Menu