當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript knockout.bindingHandlers.css類代碼示例

本文整理匯總了TypeScript中knockout.bindingHandlers.css的典型用法代碼示例。如果您正苦於以下問題:TypeScript bindingHandlers.css類的具體用法?TypeScript bindingHandlers.css怎麽用?TypeScript bindingHandlers.css使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了bindingHandlers.css類的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: {
開發者ID:spatools,項目名稱:kohandlers,代碼行數:31,代碼來源:helpers.ts

示例2:

            .on("mouseover", e => {
                options.enter && options.enter.call(viewModel, viewModel, e.originalEvent);

                if (options.classes)
                    bindingHandlers.css.update(element, () => options.classes as string);
            })
開發者ID:spatools,項目名稱:kohandlers,代碼行數:6,代碼來源:jq.ts

示例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()),
開發者ID:spatools,項目名稱:kohandlers,代碼行數:31,代碼來源:jq.ts


注:本文中的knockout.bindingHandlers.css類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。