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

@aidol/utils

v2.2.1

Published

a javascript tool

Downloads

67

Readme

@aidol/utils

vue 实用指令集合。

Docs

  1. 1.x 文档

Migration Guide

@aidol/utils 2.x 已发布,可按该 迁移指南 进行迁移。

Installation

# yarn
$ yarn add @aidol/utils
# npm
$ npm i @aidol/utils

Build

构建文件在 dist 文件夹下分为两个版本。

dist/aidol-utils.es.jses Modules 版本。

dist/aidol-utils.umd.jsumd 版本,适合使用 <script></script> 标签的方式引用。

Features

  1. vueDirectives 指令集,其中包含了一些实用指令,例:v-drag, v-affix, v-autoheight 等。

Usage

vueDirectives

该模块包含了一些 vue directive

安装指令的方式:

  1. 全局安装
// main.js

import Vue from 'vue'
import { vueDirectives } from '@aidol/utils'

// 安装全部指令
for (const k in vueDirectives) {
  if (vueDirectives.hasOwnProperty(k)) {
    Vue.directive(k, vueDirectives[k])
  }
}

// or 仅安装某个指令
Vue.directive('drag', vueDirectives.drag)

// ...
// new Vue({
//   el: 'app'
// })
  1. 局部安装
import { vueDirectives } from '@aidol/utils'

export default {
  name: 'SomeComp',
  directives: {
    drag: vueDirectives.drag,
    affix: vueDirectives.affix,
    autoheight: vueDirectives.autoheight,
    // ...
  },
}

v-drag

拖拽指令。当给某 dom 元素加上 v-drag 指令后,该元素会变成可拖拽状态。

使用方式

<template>
  <div class="some class" v-drag="draggable">this is a box.</div>
</template>
export default {
  data() {
    return {
      draggable: true,
    }
  },
}

参数

| 参数 | 类型 | 默认值 | 描述 | | :---------: | :-----: | :----: | :--------------: | | draggable | boolean | true | 控制是否可拖拽。 |

v-affix

吸顶指令。可使用该指令实现元素吸顶效果。

使用方式

<template>
  <div class="some-container">
    <div class="some-class" v-affix>this is a affix element.</div>
    <div class="next-element"></div>
  </div>
</template>

参数

暂无。

v-autoheight

自动设置高度。有时,我们希望当前页面不出现滚动条,或者某个包裹元素不会产生滚动条。那么,你可能会需要该指令,使得应用该指令的元素可以正好占满剩余视窗高度,从而不出现纵向滚动条。

使用方式

<template>
  <div class="some-container">
    <div class="some-class">this is a top element.</div>
    <div class="next-element" v-autoheight="bottomGap"></div>
  </div>
</template>
export default {
  data() {
    return {
      bottomGap: 20,
    }
  },
}

参数

| 参数 | 类型 | 默认值 | 描述 | | :---------: | :----: | :----: | :--------------------: | | bottomGap | number | 20 | 预设距离底部的高度值。 |