You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
353 B
13 lines
353 B
// 获取组件
|
|
export const getComponent = (selector) => {
|
|
const ctx = getCurrentPages()[getCurrentPages().length - 1];
|
|
const componentCtx = ctx.selectComponent(selector);
|
|
|
|
if (!componentCtx) {
|
|
throw new Error("无法找到对应的组件,请按文档说明使用组件");
|
|
}
|
|
|
|
return componentCtx;
|
|
};
|
|
|
|
export default getComponent;
|
|
|