本文整理匯總了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()),