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

maa-ui

v1.0.7

Published

我的组件库

Downloads

498

Readme

  1. 初始化项目
yarn init
  1. 安装相关依赖
yarn vue
yarn vite -D
yarn @vitejs/plugin-vue -D
yarn @vitejs/plugin-vue-jsx -D
yarn terser -D
yarn unocss -D
yarn @iconify-json/ic -D
  1. 根目录index.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app"></div>
<script src="index.txs" type="module"></script>
</body>
</html>
  1. 根目录package.json
{
  "name": "zc-ui",
  "version": "1.0.0",
  "description": "我的组件库",
  "main": "index.js",
  "author": "miaoaa",
  "license": "MIT",
  "devDependencies": {
    "@vitejs/plugin-vue": "^5.0.5",
    "@vitejs/plugin-vue-jsx": "^4.0.0",
    "terser": "^5.31.1",
    "vite": "^5.3.1",
    "vite-plugin-vue-setup-extend": "^0.4.0"
  },
  "scripts": {
    "dev": "vite",
    "build": "vite build"
  },
  "dependencies": {
    "vue": "^3.4.29"
  },
  "type": "module"
}

注明:"type": "module" 是因为Vite5不在支持cjs,而是使用了ESM 5. 根目录index.ts

import { createApp } from 'vue'
import ZcUI from "../dist/zc-ui.mjs"
import App from './App.vue'
// import GButton from './components/m-button'
// createApp(GButton).mount('#app')

// import SFCButton from "./components/SFCButton/index.vue";
// createApp(SFCButton).mount('#app')
//
// import JSXButton from "./components/JSXButton/index";
// createApp(JSXButton).mount('#app')
// 全量加载
createApp(App).use(ZcUI).mount('#app')
  1. 根目录entry.ts
import {App} from "vue";
import ZcButton from "./components/m-button/index";
import SFCButton from "./components/SFCButton/index.vue";
import JSXButton from "./components/JSXButton/index";

// 导出单独组件
export {ZcButton, SFCButton, JSXButton}

// 实现 install 方法
export default {
    install(app: App): void {
        app.component(ZcButton.name, ZcButton)
        app.component(SFCButton.name, SFCButton)
        app.component(JSXButton.name, JSXButton)
    }
}
  1. 打包测试
yarn run build
  1. 根目录src/shims-vue.d.ts
// 任何以.vue结尾的模块都应该被当作一个Vue组件模块来处理,
// 并且该模块的类型是DefineComponent。这让TypeScript能够正确地解析和处理.vue文件,
// 从而进行类型检查和代码提示
declare module "*.vue" {
    import { DefineComponent } from "vue";
    const component: DefineComponent<{}, {}, any>;
    export default component;
}
  1. 根目录tsconfig.json
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "strict": false,
    "jsx": "preserve",
    "moduleResolution": "node"
  }
}

https://www.cnblogs.com/caicai521/p/18047175