Skip to content

当执行多次 Hook::addMenuItem() 时,行为与文档描述不符 #613

Open
@tnqzh123

Description

Blessing Skin 版本

commit 866e182 @ dev branch

PHP 版本

8.1

出现问题时所使用的浏览器

Microsoft Edge

您正在使用的 Web Server

Nginx

您正在使用宝塔吗?

出现了什么问题?

插件的 bootstrap.php 中现有如下代码:

Hook::addMenuItem('explore', 3, [
    'title' => '^3',
    'link'  => '/somewhere',
    'icon'  => 'fa-3',
    'new-tab' => true,
]);

Hook::addMenuItem('explore', 2, [
    'title' => '^2',
    'link'  => '/somewhere',
    'icon'  => 'fa-2',
    'new-tab' => true,
]);

按照 Blessing Skin 插件开发文档中的描述,Hook::addMenuItem() 的第二个参数为菜单项的位置,则此时菜单项 ^2 应该在 ^3 的上方,但实际情况是 ^3 在 ^2 的上方,与文档描述不符。

image

若调换这两个方法的执行次序(即让 ^2 比 ^3 先添加),则菜单项顺序正常。

ref: https://bs-plugin.netlify.app/guide/bootstrap.html#%E6%B7%BB%E5%8A%A0%E8%8F%9C%E5%8D%95%E9%A1%B9

错误日志

No response

重现步骤

见上方问题描述

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions