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-module

v1.1.3

Published

vue3 usually uses mobile terminal function modules

Downloads

5

Readme

INTRODUCE

Based on vue3+vite built common functional component library, including Tabs,Video, Pagination, Swiper, Vote, Message components, update to be continued.

Installation

npm install vue3-module

Import

Global import

import 'vue3-module/lib/style.css' // style
import UI from 'vue3-module'

createApp(App).use(UI).use(router).mount('#app')

On-demand introduction

  • Introduce components as needed in the pages you want to use.
import { Tabs } from "vue3-module"

Basic Usage

  • When used, the corresponding attribute value is passed in according to the attribute of the corresponding component.
<template>
  <div class="main">
    <Videos />
  </div>
</template>

<script setup>
import { Videos } from "vue3-module";
</script>

<style scoped></style>

COMPONENT ATTRIBUTE

Tabs

Example

<template>
  <Tabs
    :tabList="tabList"
    @change="handleTabChange"
    :cur-index="tabIndex"
  >
  </Tabs>
</template>

<script setup>
import { ref } from 'vue'

const tabList = ref([
  // The text attribute is required, and other attributes are supported.
  { id: 1, text: "all" },
  { id: 2, text: "snack" },
  { id: 3, text: "book" },
  { id: 4, text: "food" },
])
const tabIndex = ref(0)
const handleTabChange = item => {
  tabIndex.value = item.index
}
</script>

Attributes

| Name | Description | Type | Default | | ------------- | -------------------------------------------------------- | -------- | ----------- | | bgColor | Default background color | String | #f1f5f9 | | activeBgColor | The background color is currently selected | String | #1261ff | | tabList | TAB list items, text attributes are required, and other attributes can be customized | Array | [ ] | | bdRadius | Rounded dimension with unit px | String | 50px | | curIndex | Currently selected item | Number | 0 |

Events

| Name | Description | Parameters | | ------------- | -------------------------------------------------------- | -------- | | change | Triggered when switching tabs, returning the id and the current tab object | ---- |

Videos

Example

<template>
  <videos
    video-src="https://example.mp4"
  >
  </videos>
</template>

Attributes

| Name | Description | Type | Default | | ------------- | -------------------------------------------------------- | -------- | ----------- | | videoSrc | Video address, which supports only online videos | String | '' |

Pagination

Example

<template>
  <Pagination
    :pageTotal="60"
    :pageSize="10"
    :activeBgColor="activeBgColor"
    :bgColor="bgColor"
    size="40px"
    @currentClick="handleCurrentChange"
    @prevClick="handlePrevChange"
    @nextClick="handleNextChange"
  />
</template>

<script setup>
import { ref } from 'vue'

const activeBgColor = ref('#1261ff')
const bgColor = ref('#f0f2f5')

// Page number
const handleCurrentChange = e => {
  console.log(e);
}
// Previous
const handlePrevChange = e => {
  console.log(e);
}
// Next page
const handleNextChange = e => {
  console.log(e);
}
</script>

Attributes

| Name | Description | Type | Default | | ------------- | --------------------------------------------------------- | -------- | ----------- | | pageTotal | Video address, which supports only online videos | Number | 0 | | pageSize | Total number of data items, must be transmitted | Number | 10 | | activeBgColor | Number of items per page | String | #1261ff | | bgColor | Other background colors not selected | String | #f0f2f5 | | size | Pager size, supported px, vw, rem, must carry units | String | 50px |

Events

| Name | Description | Parameters | | -------- | ------------------------------------------------------------ | -------------- | | change | Triggered when switching tabs, returning the id and the current tab object | ---- |

Swiper

Example

<template>
  <div class="box">
    <Swiper
      autoPlay
      :sliders="sliders"
      :isController="true"
      :duration="3000"
      :bgColor="bgColor"
    >
    </Swiper>
  </div>
</template>

<script setup>
const bgColor = '#fff'
const sliders = [
  'https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg',
  'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg',
  'https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg',
  'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
]
</script>

<style scoped>
.box {
  width: 100%;
  height: 400px;
}
</style>

Attributes

| Name | Description | Type | Default | | ------------- | --------------------------------------------------------- | -------- | ----------- | | sliders | Image address array, must pass | Array | [ ] | | autoPlay | Auto play or not | Boolean | false | | duration | Interval time | Number | 3000 | | isController | Whether to display a toggle button | Boolean | true | | bgColor | Indicator color | String | #fff |

Sockets

| Name | Description | | --------- | -------------------------------- | | indicator | Indicator slot, you can customize the indicator style |

Vote

Example

<template>
  <Vote
    question="您坠坠坠期待的游戏角色是哪一个?"
    :voteList="voteList"
    @change="handleChange"
  >
  </Vote>
</template>

<script setup>
import { ref } from 'vue'

const voteList = ref([
  {
    id: 1,
    option: '卡莎',
    voteNum: 1555
  },
  {
    id: 2,
    option: '金克丝',
    voteNum: 2501
  },
  {
    id: 3,
    option: '拉克丝',
    voteNum: 800
  },
  {
    id: 4,
    option: '女警',
    voteNum: 1500
  }
])

const handleChange = item => {
  console.log(item);
}
</script>

Attributes

| Name | Description | Type | Default | | ------------- | --------------------------------------------------------- | -------- | ----------- | | voteList | Voting options, mandatory, each item must contain option, voteNum attributes | Array | [ ] | | question | problem | String | '' | | bgColor | Default background color | String | #f0f0f0 | | activeBgColor | Select background color | String | #fff0f3 |

Events

| Name | Description | Returned value | | --------- | -------------------------------- |--------| | change | After successful voting, the selected item is returned to the user | ----- | item |

Message

Example

<template>
  <div @click="handleClick('success')">成功</div>
  <div @click="handleClick('warning')">警告</div>
  <div @click="handleClick('error')">错误</div>
  <div @click="handleClick('default')">默认</div>
</template>

<script setup>
import { Message } from 'vue3-module'

const handleClick = text => {
    if (text === 'success') return Message({message: '成功!', type: 'success', zIndex: 10})
    else if (text === 'warning') return Message({message: '警告!', type: 'warning'})
    else if (text === 'error') return Message({message: '错误!', type: 'error'})
    else return Message({message: '默认'})
}
</script>

Attributes

| Name | Description | Type | Default | | ------------- | --------------------------------------------------------- | -------- | ----------- | | type | default/success/warning/error | String | default | | message | Prompt text | String | —— | | zIndex | hierarchy | Number | 0 |