mixin of mini program
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
// 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
demo/
directory
yarn install
Then open the project in devtools.