As we know, in the miniprogram, Component has behaviors to reuse the same logics.But if we want to reuse these logics in Page, there is no solution.
miniprogram-mixin works.
yarn add miniprogram-mixin// app.js
require('miniprogram-mixin');Now you can use mixin happily.
// mixin/mixinA.js
module.exports = {
data: {},
onLoad() {}
}tips: You need to read the npm support documentation for the miniprogram
- in the
demo/directory
yarn installThen open the project in devtools.
- You can also open the code snippet link in wechat devtools.