@wxa/plugin-global-component-inject

2.4.1 • Public • Published

😊😊😊😊Documentation

wxa-plugin-replace

NPM version

🎉向所有页面注入组件

Usage

//wxa.config.js
const {
  InjectCompileTimePlugin,
} = require("@wxa/plugin-global-component-inject/compile");
new InjectCompileTimePlugin([
  { path: "/components/comp.wxa", name: "injectComp" },
]);

//app.wxa
import { runtimePlugin } from "@wxa/plugin-global-component-inject";
wxa.use(runtimePlugin);
// when you have *this* of Component or Page
this.getInjectedComponent("injectComp");
this.invokeInjectedComponent("injectComp", "args1", "args2");
// or
import { helpers } from "@wxa/plugin-global-component-inject";
helpers.get("injectComp");
helpers.invoke("injectComp", null, "args");

Readme

Keywords

Package Sidebar

Install

npm i @wxa/plugin-global-component-inject

Weekly Downloads

3

Version

2.4.1

License

MIT

Unpacked Size

5.2 kB

Total Files

6

Last publish

Collaborators

  • genuifx
  • zehuiguan
  • lucaszhu
  • fanniehuang
  • baoooooo