@pluginarch/create-parch
Version:
this is way to create a ui project
28 lines (27 loc) • 976 B
text/typescript
export default (api: any) => {
api.onStart(() => {
console.log("开始:执行了 onRuntimePluginRegister 插件");
});
api.onEnd(() => {
console.log("结束:执行了 onRuntimePluginRegister 插件");
});
api.registerRunTimePlugin(
{
name: "countNode",
alias: "v",
description: "calcuate hd-button count",
fn:function fn(className:string, nodeName:string) {
const pNodeapp = document.querySelector('.'+className)?.shadowRoot
const pNode = pNodeapp?.querySelector('pe-'+className.toLocaleLowerCase())?.shadowRoot
let num = 0
if(pNode) {
const nodeList = pNode.querySelectorAll(nodeName)
if(nodeName && nodeList && nodeList.length) {
num = nodeList.length
}
}
return num
},
}
);
};