@10up/component-accordion 中文文档教程

发布于 3年前 浏览 21 项目主页 更新于 3年前

10up Accordion component

查看此包的官方文档

Installation

npm install --save @10up/component-accordion

Usage

CSS Imports

@import url("@10up/component-accordion");

通过使用 PostCSS 导入,或通过在项目中包含独立的 CSS 文件,可以将样式导入到现有代码库中。

JavaScript

通过提供用于手风琴的选择器和包含任何必要回调函数的对象来创建一个新实例。

import Accordion from '@10up/component-accordion';

new Accordion( '.accordion', {
    onCreate: function() {
        console.log( 'onCreate callback' );
    },
    onOpen: function( { link, content, heading } ) {
        console.log( 'onOpen callback' );
    },
    onClose: function( { link, content, heading } ) {
        console.log( 'onClose callback' );
    },
    onToggle: function( { link, content, heading } ) {
        console.log( 'onToggle callback' );
    }
} );

Demo

示例实施在:https

Support Level

://baseline.10up.com/component/accordion/ Active: 10up 正在积极致力于此,我们希望在可预见的未来继续工作,包括保持测试到最新版本的 WordPress。 欢迎错误报告、功能请求、问题和请求请求。

Like what you see?

10up Accordion component

View official documentation for this package

Installation

npm install --save @10up/component-accordion

Usage

CSS Imports

@import url("@10up/component-accordion");

The styles can be imported into your existing codebase by using PostCSS imports, or by including the standalone CSS file in your project.

JavaScript

Create a new instance by supplying the selector to use for the accordion and an object containing any necessary callback functions.

import Accordion from '@10up/component-accordion';

new Accordion( '.accordion', {
    onCreate: function() {
        console.log( 'onCreate callback' );
    },
    onOpen: function( { link, content, heading } ) {
        console.log( 'onOpen callback' );
    },
    onClose: function( { link, content, heading } ) {
        console.log( 'onClose callback' );
    },
    onToggle: function( { link, content, heading } ) {
        console.log( 'onToggle callback' );
    }
} );

Demo

Example implementations at: https://baseline.10up.com/component/accordion/

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Like what you see?

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文