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

@ravens-wxk/cts-main-basic-service

v1.0.0

Published

文旅集市前端公共基础服务

Downloads

2

Readme

文旅集市前端公共基础服务

当前服务:

  • [ ] 国际化翻译 i18n
    • [x] zh-cn
    • [x] en
  • [ ] 格式化服务 format.*
    • [x] time
  • [ ] 网络服务 request

使用方法:

国际化翻译 i18n

// main.js
import { i18n } from 'cts-main-basic-service'
// 初始化可能用到的语言,默认为 ['zh-cn', 'en']
const lang = ['zh-cn', 'en']
const projectI18n = new i18n(lang)

Vue.prototype.$i18n = projectI18n.get

ps: lang 参数的第一个是即将使用语言

// *.vue
<div>{{$i18n(KEY)}}</div>

ps: KEY 是翻译的键值,详情稍后提供

扩展翻译: extend

可在基础翻译包的基础上自由扩展,不局限于语言、数据

const lang = ['zh-cn', 'en', 'ja']
const projectI18n = new i18n(lang)
const datas = {
  'zh-cn': {
    key1: '文字1'
  },
  'en': {
    key1: 'key1'
  },
  'ja': {
    key1: 'キー1'
  }
}
projectI18n.extend(datas)

自由切换: use

可随时切换当前选择语言(需初始化)

const lang = ['zh-cn', 'en', 'ja']
const projectI18n = new i18n(lang)
projectI18n.use('en')

格式化服务

time

// main.js
import { format } from 'cts-main-basic-service'
Vue.prototype.$formatTime = format.time

// *.vue
<div>{{$formatTime(Date.now(), 'YYYY/MM/DD HH:mm:ss')}}</div>

网络请求

待完成...