定制 kilroyweb/klink 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kilroyweb/klink

Composer 安装命令:

composer require kilroyweb/klink

包简介

Package for easily setting classes for active links

README 文档

README

#Klink

A simple way to manage active menu items

Install

composer require kilroyweb/klink

In config/app.php 'providers':

KilroyWeb\Klink\KlinkServiceProvider::class,

In config/app.php 'facades':

'Klink'=> KilroyWeb\Klink\Facades\Klink::class,

Usage

Klink must start with the "url" method, from there options can be added as needed

Create menu items

<ul>
    {!! Klink::url('my-account')->label('My Account') !!}
    {!! Klink::url('logout')->label('Logout') !!}
</ul>

Results (If on /my-account page)

<ul>
    <li class="active"><a href="http://localhost/my-account">My Account</a></li>
    <li><a href="http://localhost/logout">Logout</a></li>
</ul>

Remove change or remove "li" container element

{!! Klink::url('my-account')->label('My Account')->container(false) !!}
{!! Klink::url('my-account')->label('My Account')->container('h3') !!}

Results

<a href="http://localhost/my-account">My Account</a>
<h3><a href="http://localhost/my-account">My Account</a></h3>

Or when on the "my-account" page:

<a href="http://localhost/my-account" class="active" >My Account</a>
<h3 class="active"><a href="http://localhost/my-account">My Account</a></h3>

Check Multiple URLs

{!! Klink::url('my-account')->alsoCheck(['/profile', '/'])->label('My Account') !!}

Results (when on the /profile, /, or /my-account pages)

<h3 class="active"><a href="http://localhost/my-account">My Account</a></h3>

Output only the active class

Sometimes you have a custom link where you just need to set the class as active:

    <ul>
        <li class="{!! Klink::url('my-account')->showClass() !!}"><a href="http://homestead.app/packages/klink/public/my-account">My Account</a></li>
    </ul>

Will return class="active" on the my-account page, otherwise will return empty class=""

统计信息

  • 总下载量: 112
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固