acpl/mobile-tab
Composer 安装命令:
composer require acpl/mobile-tab
包简介
关键字:
README 文档
README
A Flarum extension. Adds a bottom tab on mobile.
Installation
Install with composer:
composer require acpl/mobile-tab
Updating
composer update acpl/mobile-tab php flarum migrate php flarum cache:clear
Extending
Important
These instructions are for Flarum 2.0. For Flarum 1.x documentation, please refer to: Flarum 1.x Guide
You can add, modify, and delete items in the mobile tab using your own extension. Read: https://docs.flarum.org/2.x/extend/extending-extensions
- Install
acpl/mobile-tabas your extension's composer dependency or add it as an optional dependency in yourcomposer.json. - In the
tsconfig.jsonfile add"ext:acpl/mobile-tab/*": ["../vendor/acpl/mobile-tab/js/dist-typings/*"]to thecompilerOptions.pathsobject. - You can now import and use the registry classes to modify the mobile tab.
Example
Create extendMobile.ts in your extension's js/common directory:
import MobileTabItemsRegistry from "ext:acpl/mobile-tab/common/MobileTabItemsRegistry"; import app from "flarum/common/app"; import { extend } from "flarum/common/extend"; export default () => { extend(MobileTabItemsRegistry.prototype, "items", (items) => { // Add a simple link item items.add("following", { icon: "fas fa-star", label: app.translator.trans("my-ext.forum.index.following_label"), href: () => app.route("following"), canView: () => !!app.session.user, source: "extension", }); // Add an item that we plan to turn into an interactive component on the forum frontend items.add("my-interactive-item", { icon: "fas fa-rocket", label: app.translator.trans("my-ext.forum.my_interactive_item_label"), source: "extension", }); }); };
Use this file in both admin and forum. Example for the admin side:
import app from "flarum/admin/app"; import extendMobileTab from "../common/extendMobileTab"; app.initializers.add("my-ext/mobile-tab-example", () => { extendMobileTab(); // ... other initializers });
To make an item interactive on the forum, assign a component using the forumComponent property.
Note
Interactive components should be registered in MobileTabItemsRegistryForum because they import from flarum/forum/*.
Registering them in the common registry would break the admin panel.
import MobileTabItemsRegistryForum from "ext:acpl/mobile-tab/forum/data/MobileTabItemsRegistryForum"; import { extend } from "flarum/common/extend"; import app from "flarum/forum/app"; import extendMobileTab from "../common/extendMobileTab"; import MyCustomTabItem from "./components/MyCustomTabItem"; app.initializers.add("my-ext/mobile-tab-example", () => { extendMobileTab(); extend(MobileTabItemsRegistryForum.prototype, "items", (items) => { // Get the item defined in common and enhance it for the forum const myItem = items.get("my-interactive-item"); items.setContent("my-interactive-item", { ...myItem, // Keep icon, label, and other shared properties forumComponent: MyCustomTabItem, // Add the forum-only interactive component }); }); // ... other initializers });
import MobileTabComponent from "ext:acpl/mobile-tab/common/components/MobileTabComponent"; import Button from "flarum/common/components/Button"; export default class MyCustomTabItem extends MobileTabComponent { view() { const { icon, label } = this.attrs.definition; return ( <Button className="Button MyCustomTabComponent" icon={icon} onclick={() => console.log("clicked")} > {label} </Button> ); } }
Links
acpl/mobile-tab 适用场景与选型建议
acpl/mobile-tab 是一款 基于 TypeScript 开发的 Composer 扩展包,目前已累计 33.94k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2021 年 07 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「flarum」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 acpl/mobile-tab 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 acpl/mobile-tab 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 acpl/mobile-tab 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Adds more BBCode
Output of discussions lists in form of cards
Allow users to log in with QQ
A headless CLI performance benchmarking tool for Flarum
The admin panel of afrux/asirem
Enhanced typography for french writings, mainly around punctuation.
统计信息
- 总下载量: 33.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 15
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-18