通过微信开发者工具 商城模板 创建新小程序
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
function getInstance(context, selector = '#wr-reason-sheet') {
|
||||
if (!context) {
|
||||
const pages = getCurrentPages();
|
||||
const page = pages[pages.length - 1];
|
||||
context = page;
|
||||
}
|
||||
const instance = context && context.selectComponent(selector);
|
||||
if (!instance) {
|
||||
console.warn(`未找到reason-sheet组件,请检查selector是否正确`);
|
||||
return null;
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
export default function (options) {
|
||||
const { context, selector, ..._options } = options;
|
||||
return new Promise((resolve, reject) => {
|
||||
const instance = getInstance(context, selector);
|
||||
if (instance) {
|
||||
instance.setData(Object.assign({}, _options));
|
||||
instance._onCancel = () => reject();
|
||||
instance._onConfirm = (indexes) => resolve(indexes);
|
||||
}
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user