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

@twoke/vite-plugin-uniapp-pages

v0.0.2

Published

Uniapp扩展pages.json配置功能的Vite插件

Downloads

126

Readme

@twoke/vite-plugin-uniapp-pages

npm version npm downloads

本项目基于 @uni-helper/vite-plugin-uni-pages

vite-plugin-uniapp-pages-config@uni-helper/vite-plugin-uni-pages的基础上开发了@twoke/vite-plugin-uniapp-pages

该插件主要实现的功能:

  • [x] 新增全局宏定义 defineRoute,使用该宏会动态解析路由信息生成pages.json
  • [x] 新增pages.config.[ts|mts|cts|cjs|mjs|json]配置全局信息,例如;Tabbar的字体配置,选中样式配置
  • [x] 新增生成uni-pages.d.ts,在使用ts时,可以提供路由跳转的代码提示,后续会提供常量定义的方式
  • [ ] 实现vite-plugin-uniapp-pages-config 提供的分文件配置

安装

pnpm add -D @twoke/vite-plugin-uniapp-pages

使用

// vite.config.ts
import { defineConfig } from 'vite'
import Uni from '@dcloudio/vite-plugin-uni'
import UniAppPages from '@twoke/vite-plugin-uniapp-pages'

// It is recommended to put it in front of Uni
export default defineConfig({
  plugins: [UniAppPages(), Uni()],
})

在pages.config中定义全局属性(ts|mts|cts|js|cjs|mjs|json),你可以在文件中使用#ifdef H5。

// pages.config.ts
import { defineUniPages } from '@twoke/vite-plugin-uniapp-pages'

export default defineUniPages({
  // pages配置vue页面配置优先级更高
  globalStyle: {
    navigationBarTextStyle: 'black',
    navigationBarTitleText: '@uni-helper',
  },
})

你可以使用defineRoute创建路由,需要注意的是defineRoute里面的配置不要使用变量

<script lang='ts' setup>

defineRoute({
  style: {
    navigationBarTitleText: '首页222'
  },
  tabBar: {} // 定义这个页面是Tabbar, 可以传 boolean | number | object
})

</script>

<template >
  <view>这是首页</view>
</template>

<style scoped lang='scss'>
</style>