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.
27 lines
987 B
27 lines
987 B
import $wuxCountDown from './countdown/index'
|
|
|
|
/**
|
|
* 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象
|
|
* @param {String} selector 节点选择器
|
|
* @param {Object} ctx 页面栈或组件的实例,默认为当前页面栈实例
|
|
*/
|
|
const getCtx = (selector, ctx = getCurrentPages()[getCurrentPages().length - 1]) => {
|
|
const componentCtx = ctx.selectComponent(selector)
|
|
if (!componentCtx) {
|
|
throw new Error('无法找到对应的组件,请按文档说明使用组件')
|
|
}
|
|
return componentCtx
|
|
}
|
|
|
|
const $wuxActionSheet = (selector = '#wux-actionsheet', ctx) => getCtx(selector, ctx)
|
|
const $wuxBackdrop = (selector = '#wux-backdrop', ctx) => getCtx(selector, ctx)
|
|
const $wuxDialog = (selector = '#wux-dialog', ctx) => getCtx(selector, ctx)
|
|
const $wuxKeyBoard = (selector = '#wux-keyboard', ctx) => getCtx(selector, ctx)
|
|
|
|
export {
|
|
$wuxDialog,
|
|
$wuxActionSheet,
|
|
$wuxBackdrop,
|
|
$wuxCountDown,
|
|
$wuxKeyBoard
|
|
}
|