npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pori15/split-pane

v1.0.9

Published

A split panel for vue3, using TS

Readme

@pori15/split-pane

分割面板示例

简介

  • @pori15/split-pane 是一个基于 Vue3+TypeScript 的分割面板组件,功能类似于 vscode 的面板分割,常见于在线代码编辑器、管理后台等需要灵活布局的场景。
  • 支持垂直(左右)和水平(上下)分割模式
  • 支持嵌套使用,可创建复杂的多面板布局
  • 提供完善的无障碍访问支持
  • 响应式设计,适配移动设备

安装

npm install @pori15/split-pane --save

或使用 pnpm(推荐)

pnpm add @pori15/split-pane

基本用法

<template>
  <split-pane :min-percent="0" :default-percent="20" split="vertical">
    <template v-slot:paneL> vertical-A </template>
    <template v-slot:paneR>
      <split-pane split="horizontal" :default-percent="75">
        <template v-slot:paneL> horizontal-B </template>
        <template v-slot:paneR>
          <split-pane split="vertical" :default-percent="75">
            <template v-slot:paneL> vertical-C </template>
            <template v-slot:paneR> vertical-D </template>
          </split-pane>
        </template>
      </split-pane>
    </template>
  </split-pane>
</template>

<script setup lang="ts">
import { defineAsyncComponent } from "vue";
const SplitPane = defineAsyncComponent(() => import("@pori15/split-pane"));
</script>

属性

| 属性名 | 类型 | 默认值 | 说明 | | -------------- | ------ | ------ | ------------------------------------------------------------------------------ | | minPercent | Number | 10 | 面板的最小尺寸百分比 | | defaultPercent | Number | 50 | 面板的默认尺寸百分比 | | split | String | - | 分割方向:'vertical'(垂直分割,左右布局)或'horizontal'(水平分割,上下布局) | | className | String | - | 分割条的自定义类名,用于自定义样式 |

插槽

| 名称 | 说明 | | ----- | -------------------- | | paneL | 左侧或上侧面板的内容 | | paneR | 右侧或下侧面板的内容 |

事件

| 事件名 | 参数 | 说明 | | ------ | --------------- | ------------------------------------------------ | | resize | percent: number | 当面板大小调整时触发,返回当前分割位置的百分比值 |

高级用法

嵌套分割面板

可以在任意面板内嵌套使用SplitPane组件,创建复杂的多面板布局:

<template>
  <div class="container">
    <split-pane split="vertical" :default-percent="30">
      <!-- 左侧导航面板 -->
      <template v-slot:paneL>
        <div class="nav-panel">导航菜单</div>
      </template>
    
      <!-- 右侧内容区,再次分割 -->
      <template v-slot:paneR>
        <split-pane split="horizontal" :default-percent="70">
          <!-- 上方内容区 -->
          <template v-slot:paneL>
            <div class="content-panel">主要内容</div>
          </template>
        
          <!-- 下方控制台区 -->
          <template v-slot:paneR>
            <div class="console-panel">控制台输出</div>
          </template>
        </split-pane>
      </template>
    </split-pane>
  </div>
</template>

自定义分割条样式

通过提供自定义className,可以覆盖默认的分割条样式:

<template>
  <split-pane split="vertical" class-name="custom-resizer">
    <!-- 面板内容 -->
  </split-pane>
</template>

<style>
.custom-resizer {
  /* 自定义分割条样式 */
  background-color: #3498db !important;
  opacity: 0.5 !important;
}
</style>

无障碍支持

组件内置了ARIA属性支持,提供了良好的无障碍访问体验:

  • 分割面板容器具有 role="presentation"aria-label="可调整大小的分割面板"
  • 分割条具有 role="separator",可通过键盘操作
  • 面板大小变化时会更新 aria-valuenow属性

浏览器兼容性

  • 支持所有现代浏览器
  • 针对移动设备进行了触摸优化

许可证

MIT