@sxo/plugin-uniapp
v0.1.1
Published
UniApp adaptor for SXO Design System.
Downloads
40
Maintainers
Readme
@sxo/uniapp is an adaptor specifically designed for the UniApp ecosystem (Mini Programs, APP, H5). It resolves various display and interaction anomalies of standard Web components in restricted environments like WeChat Mini Programs.
✨ Key Features
- 🚀 Compile-time Optimization: Runtime style scanning is removed. All atomic classes are generated by
vite-plugin-sxoduring the build phase. - 🎨 Mini Program Compatibility: Fixes icon rendering (Data URI conversion), button border reset, and
scroll-viewheight collapse for Mini Programs. - 📦 Lightweight Implementation: Special redundant code for Web is removed, focusing on UniApp's cross-platform capabilities.
- 🛡️ Type Safe: Inherits full TypeScript definitions from the SXO ecosystem.
🚀 Quick Start
Installation
pnpm add @sxo/uniapp @sxo/theme-antd @sxo/design1. Register the Plugin (main.ts)
import { createSSRApp } from 'vue';
import { createSxo } from '@sxo/uniapp';
import { antdTheme } from '@sxo/theme-antd';
import App from './App.vue';
import 'virtual:sxo.css'; // Must import styles generated during compilation
export function createApp() {
const app = createSSRApp(App);
app.use(createSxo({ theme: antdTheme }));
return { app };
}2. Basic Usage
<template>
<view class="p-4">
<SxoIcon name="Link2" color="#228AFF" size="48rpx" />
<text>Hello SXO UniApp!</text>
</view>
</template>
<script setup lang="ts">
import { SxoIcon } from '@sxo/uniapp';
</script>📄 License
MIT License.
