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

j-view-uniapp

v0.0.20

Published

presonal uniapp components

Downloads

24

Readme

j-view-uniapp

j-view-uniapp 封装了个人使用的组件和工具。 j-view-uniapp 依赖 uni-ui 且只支持 vue3 + vite + typescript。 项目使用 unocss 进行样式处理。

安装

pnpm add j-view-uniapp @dcloudio/uni-ui vue-i18n
pnpm add -D sass sass-loader unocss unocss-applet

unocss 配置

vite 启用 unocss :

// vite.config.ts
import { defineConfig } from 'vite';
import uni from '@dcloudio/vite-plugin-uni';
import Unocss from 'unocss/vite';

export default defineConfig({
  plugins: [uni(), Unocss()],
});

通过 ~~~unocss.config.ts~~~ 进行 unocss 配置

import {
  defineConfig,
  presetAttributify,
  transformerDirectives,
  transformerVariantGroup,
} from 'unocss';

import {
  presetJViewUniapp,
  presetRemToRpx,
  transformerApplet,
  transformerAttributify,
} from 'j-view-uniapp/uno-preset/index';

// UniApp
const isApplet = !(process?.env?.UNI_PLATFORM === 'h5');

export default defineConfig({
  presets: [
    presetJViewUniapp({ enable: isApplet }),
    presetAttributify(),
    presetRemToRpx({ enable: isApplet }),
  ],
  transformers: [
    transformerDirectives(),
    transformerVariantGroup(),
    // Don't change the following order
    transformerAttributify({ enable: isApplet }),
    transformerApplet({ enable: isApplet }),
  ],
});

在项目 main.ts 引入样式文件

// src/main.ts

// reset
import 'j-view-uniapp/styles/reset.css';
// jview extra css
import 'j-view-uniapp/styles/jview.css';
// uno
import 'uno.css';

在 nvue 页面中使用 unocss

1、使用 vite-plugin-uni-twucss 插件:https://github.com/maitel2020/vite-plugin-uni-twucss 2、在 app-nvue 中只支持 @apply 写法:https://github.com/unocss/unocss/tree/main/packages/transformer-directives 3、nvue 中可用的 css 样式以及默认行为和 vue 页面有差异:https://uniapp.dcloud.net.cn/tutorial/nvue-outline.html

组件 easycom

打开项目根目录下的 pages.json 并添加 easycom 节点:

// pages.json
{
  "easycom": {
    "autoscan": true,
    "custom": {
      // uni-ui 规则如下配置
      "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
      "^Uni(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue",
      // j-view 组件
      "^j-(.*)": "j-view-uniapp/components/j-$1/j-$1.vue",
      "^J(.*)": "j-view-uniapp/components/j-$1/j-$1.vue"
    }
  },

  // 其他内容
  "pages": [
    // ...
  ]
}

组件 types

// tsconfig.json
{
  "compilerOptions": {
    "types": [
      "j-view-uniapp",
      "@dcloudio/types", // 建议安装
      "@uni-helper/uni-app-types", // 建议
      "@uni-helper/uni-ui-types" // 建议安装
    ]
  }
}

其它注意事项

https://github.com/dcloudio/uni-ui