本文整理汇总了TypeScript中bobril.focus函数的典型用法代码示例。如果您正苦于以下问题:TypeScript focus函数的具体用法?TypeScript focus怎么用?TypeScript focus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了focus函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onPointerDown
];
me.attrs = {
role: "checkbox",
"aria-checked": checked ? "true" : "false",
"aria-disabled": disabled ? "true" : "false"
};
if (!disabled)
me.attrs.tabindex = d.tabindex || 0;
},
onPointerDown(ctx: IToggleCtx): boolean {
if (ctx.data.disabled) return false;
ctx.focusFromKeyboard = false;
if (b.pointersDownCount() === 1) {
ctx.down = true;
b.registerMouseOwner(ctx);
b.focus(ctx.me);
}
b.invalidate(ctx);
return true;
},
onPointerUp(ctx: IToggleCtx): boolean {
ctx.down = false;
b.releaseMouseOwner();
if (b.pointersDownCount() === 0 && !ctx.data.disabled) {
let a = ctx.data.action;
ctx.rippleStart = b.now();
if (a) a();
}
b.invalidate(ctx);
return true;
},
示例2: postUpdateDom
b.emitChange(ctx.data, ctx.data.unselectedValue);
}
},
postUpdateDom(ctx: IRadioButtonGroupCtx) {
let shouldBeFocused = ctx.selIdx;
if (shouldBeFocused === -1) {
shouldBeFocused = ctx.firstEnabled;
}
if (shouldBeFocused < 0) return;
let f = b.focused();
if (f) f = f.parent;
if (f) {
const c = f.ctx;
const list = ctx.list;
for (let i = 0; i < list.length; i++) {
if (list[i] === c) {
if (i != shouldBeFocused) {
b.focus(list[shouldBeFocused].me);
}
ctx.forceFocus = false;
return;
}
}
}
if (ctx.forceFocus) {
b.focus(ctx.list[shouldBeFocused].me);
}
ctx.forceFocus = false;
}
});