@wxa/plugin-global-component-inject
v2.5.1
Published
global component inject
Downloads
6
Keywords
Readme
:blush::blush::blush::blush:Documentation
wxa-plugin-replace
:tada:向所有页面注入组件
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");