🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@voyage-x/hooks

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@voyage-x/hooks

Voyage hooks

latest
npmnpm
Version
0.0.3
Version published
Maintainers
0
Created
Source

@voyage-x/hooks 使用指南

安装

首先,确保你的项目已经使用 Vue 3 和支持 Vue 3 的构建工具(如 Vite 或 Vue CLI)搭建完毕。接下来,通过 npm 或 yarn 将 @voyage-x/hooks 添加到你的项目依赖中。

使用 npm

npm install @voyage-x/hooks

使用 yarn

yarn add @voyage-x/hooks

基础使用示例

@voyage-x/hooks 提供了一系列实用的 Vue 3 Composition API Hooks,旨在简化开发流程,提升代码可维护性。以下是一些核心 Hook 的使用演示:

onMountedOrActivated

此 Hook 组合了 Vue 3 的 onMountedonActivated 生命周期钩子,使得逻辑既能在组件挂载时执行,也能在组件被激活时执行。

<script setup> 
  import { onMountedOrActivated } from '@voyage-x/hooks'; 
  onMountedOrActivated(() => { console.log('组件已挂载或被激活'); }); 
</script>

useAttrs

方便地访问传递给组件的属性(Props)。

<script setup> 
  import { useAttrs } from '@voyage-x/hooks'; 
  const attrs = useAttrs(); console.log(attrs); 
</script>

开始使用 @voyage-x/hooks,让您的 Vue 3 开发之旅更加顺畅高效!

Keywords

voyage-x

FAQs

Package last updated on 27 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts