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 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue3-progress-scroll

v1.2.6

Published

🎉🎉🤖 `vue3-progress-scroll` 轻量版 滚动进度可视化插件, 融入 Vue3 Hooks, 更方便使用, 感受开发的乐趣 ~

Downloads

49

Readme

progress-scroll 滚动进度可视化插件

🤖🎉🎉 进度监控可视化插件是一个基于 原生 Css + Vue3 钩子 封装的实用 hooks 工具,用于在 Vue.js 应用程序中展示进度。它提供了一种简单、高效的操作体验、深深感受开发的乐趣 ~

📦 体验

一键速看

🌍 安装

你可以使用 npm 或 pnpm 安装插件:

npm i vue3-progress-scroll

🛹 注入

在你的主应用程序入口文件(例如 main.js)中,导入并使用 : main.js

/* Step 1
------------------------------------------------------------------ */
import { useScroll } from "vue3-progress-scroll";
const app = createApp(App);
app.use(useScroll);

🎉 配置

/* Step 2
------------------------------------------------------------------ */
// 注册插件并提供自定义的进度条属性(可选)例如:
app.use(useScroll, {
	progress: "green", // 进度条颜色
	progressRollback: "#fff", // 进度条回滚颜色
	progressTop: "3px", // 进度条距离顶部的距离
	progressLeft: "0px", // 进度条距离左边的距离
	UIViewBackground: "#fff", // 页面背景色
});

🤖 使用方法

一旦你设置了插件,你就可以在组件中使用 $openScroll 和 $closeScroll() 方法:

第一种 inject

/* Step 3
------------------------------------------------------------------ */
// 💡 在父容器绑定类名
<div class="ProgressTopBar">
    <p v-for="(item, index) in 1000" :key="index">{{ index + 1 }}</p>
</div>

import { ref, inject } from "vue";
import { scrollKey } from "vue3-progress-scroll";
inject<typeof scrollKey>(scrollKey).$openScroll();
inject<typeof scrollKey>(scrollKey).$closeScroll();

第二种 getCurrentInstance()

import { getCurrentInstance } from "vue";
const { proxy }: any = getCurrentInstance();
proxy.$openScroll();
proxy.$closeScroll();

📝 使用示例 Demo.vue


<template>
	<div class="ProgressTopBar">
		<p v-for="(item, index) in items" :key="index">{{ item }}</p>
	</div>
</template>

<script setup lang="ts">
	// vue3.2.0+ 之后支持的新特性
	defineOptions({
		name: "scrollBar", // 组件名
		inheritAttrs: false, // 是否继承父组件的属性
	});
	import { ref, inject } from "vue";
	const items = ref<string[]>([]);
	for (let i = 0; i < 200; i++) items.value.push(`Item ${i + 1}`);

   import { scrollKey } from "vue3-progress-scroll";
   inject<typeof scrollKey>(scrollKey).$openScroll();
   inject<typeof scrollKey>(scrollKey).$closeScroll();
</script>

💌 原理

一键快阅源码(约 20 行)9-28