本文整理汇总了TypeScript中knockout.bindingHandlers.css.update方法的典型用法代码示例。如果您正苦于以下问题:TypeScript bindingHandlers.css.update方法的具体用法?TypeScript bindingHandlers.css.update怎么用?TypeScript bindingHandlers.css.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类knockout.bindingHandlers.css
的用法示例。
在下文中一共展示了bindingHandlers.css.update方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: update
update(element, valueAccessor) {
const href = unwrap(valueAccessor());
bindingHandlers.attr.update(element, () => { return { href }; });
}
};
bindingHandlers.mailto = {
update(element, valueAccessor) {
const email = unwrap(valueAccessor());
bindingHandlers.href.update(element, () => "mailto:" + email);
}
};
bindingHandlers.classes = {
update(element, valueAccessor) {
bindingHandlers.css.update(element, valueAccessor);
}
};
declare module "knockout" {
interface BindingHandlers {
src: {
update(element: HTMLImageElement, valueAccessor: () => MaybeSubscribable<string>): void;
};
href: {
update(element: HTMLElement, valueAccessor: () => MaybeSubscribable<string>): void;
};
mailto: {
update(element: HTMLElement, valueAccessor: () => MaybeSubscribable<string>): void;
};
classes: {
示例2:
.on("mouseover", e => {
options.enter && options.enter.call(viewModel, viewModel, e.originalEvent);
if (options.classes)
bindingHandlers.css.update(element, () => options.classes as string);
})
示例3: unwrap
down = unwrap(value.down),
useParent = unwrap(value.useParent),
target = useParent ?
$(element).parent().get(0) :
element;
$(target).data("ko-toggle-class", {
off: off,
on: on,
down: down,
});
$(target).on({
mouseenter() {
bindingHandlers.css.update(element, createToggleClassAccessor(this, false, true, false));
},
mouseout() {
bindingHandlers.css.update(element, createToggleClassAccessor(this, true, false, false));
},
mousedown() {
bindingHandlers.css.update(element, createToggleClassAccessor(this, false, false, true));
},
mouseup() {
bindingHandlers.css.update(element, createToggleClassAccessor(this, false, true, false));
}
});
},
update(element, valueAccessor) {
const
value = unwrap(valueAccessor()),