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

ossaui

v0.7.4

Published

![OSSA LOGO](https://yanxuan.nosdn.127.net/static-union/16563138291bb87d.png)

Downloads

91

Readme

OSSA

OSSA LOGO

Taro官方推荐的企业级多端 UI 库。目前已支持React语法。

示例

快速上手

OSSA目前支持Taro3,Taro1/Taro2版本敬请期待。

安装

  1. 首先需要有一个基于Taro的React项目,详细请参考Taro快速开始
npm install -g @tarojs/cli
taro init myApp
  1. 安装OSSA
npm install ossaui

使用

  1. 在入口文件中引入样式文件
// app.tsx
import 'ossaui/dist/style/index.scss'

// 或者在app.scss中引入
@import '~ossaui/dist/style/index.scss'
  1. 配置编译时对组件库进行编译

如果不对组件库进行编译,组件库内的样式文件不会经过postcss处理

module.exports = {
  // ...
  h5: {
    // ...
    esnextModules: ['ossaui']
  }
}
  1. 在页面中引入OSSA组件
// page/index.tsx
import { OsButton } from 'ossaui'

const demo = () => {
  return (
    <OsButton type='primary' onClick={()=>handleClick()}>按钮</OsButton>
  )
}

按需引入

组件的样式文件既可以在入口文件引入,也可以在使用组件时,按需引入

// page/index.tsx
import { OsButton } from 'ossaui'

注意,目前组件库的按需引入需要借助一个babel插件babel-plugin-import来实现

首先需要安装

npm i babel-plugin-import -D

然后在babel.config.js文件中添加如下配置:

plugins: [
  [
    'import',
    {
      libraryName: 'ossaui',
      customName: (name) => `ossaui/lib/components/${name.replace(/^os-/, '')}`,
      customStyleName: (name) => `ossaui/dist/style/components/${name.replace(/^os-/, '')}.scss`
    },
    'ossaui'
  ]
]

预览

详细Taro项目预览可参考Taro文档

// 微信小程序预览
npm run dev:weapp

// h5预览
npm run dev:h5

开源协议

MIT

Copyright (c) 2022 Yanxuan