Wot UI Component Library
website·Indexed 32 days ago
https://v1.wot-ui.cn/An AI-friendly component library for uni-app featuring a comprehensive set of UI components including ActionSheet, Avatar, Calendar, Form, Input, and Layout. It provides global configuration via ConfigProvider for dark mode and theme customization, and is designed to be easily understood by AI tools like VSCode, Cursor, and TRAE.
What's inside Wot UI
- wot-design-uni is a UI component library built with Vue 3 and TypeScript, following the wot design specifications. It provides over 80 high-quality components designed to improve development efficiency and provide a unified UI interaction experience. Key capabilities include support for dark mode, internationalization (with 15 built-in language packs), and theme customization via CSS variables.
Overview of ColPicker Multi-column Selector
Thewd-col-pickercomponent is a multi-column selector designed for cascading selections (e.g., selecting Province, City, and District). It supports infinite levels of selection and provides a high-quality interaction experience for hierarchical data.Supported platforms for Wot UI
Wot UI currently supports the following platforms: WeChat Mini Program, Alipay Mini Program, DingTalk Mini Program, H5, and APP.Use the Avatar component to display user profiles
Thewd-avatarcomponent represents a user or entity and supports three display types: images, text, or icons. It can be used as a standalone element or within an avatar group.<!-- Image avatar --> <wd-avatar src="https://example.com/avatar.jpg" /> <!-- Text avatar --> <wd-avatar text="U" /> <!-- Icon avatar --> <wd-avatar icon="user" />Use the Gap component for layout spacing
Thewd-gapcomponent is used in page layouts as an alternative to margin or padding, or as a placeholder element (typically at the bottom of a page). It allows developers to define a specific height and background color to create visual separation between elements.Implement basic electronic signature
Use thewd-signaturecomponent to provide a basic signing area. The@confirmevent returns aSignatureResultobject containing the temporary file path of the generated image. To improve exported image quality, setexport-scaleto 2 or higher.<wd-signature @confirm="confirm" @clear="clear" :export-scale="2" background-color="#ffffff" />function confirm(result: SignatureResult) { if (result.success) { uni.previewImage({ urls: [result.tempFilePath] }) } } function clear() { // Logic to clear local image state }Create a video carousel
The
wd-swipersupports video URLs in thelistarray.Important Constraints: Embedded videos are only supported on
h5,微信小程序(WeChat Mini Program), and钉钉小程序(DingTalk Mini Program). Other platforms are not supported.Key props for video control:
autoplayVideo: Set tofalseto prevent videos from playing automatically.stopAutoplayWhenVideoPlay: Stops the carousel from sliding to the next item while a video is playing.
<wd-swiper :list="videoList" autoplay stopAutoplayWhenVideoPlay :autoplayVideo="false" :indicator="{ type: 'fraction' }" indicator-position="top-right" ></wd-swiper>const videoList = ref([ 'https://unpkg.com/wot-design-uni-assets@1.0.3/VID_115503.mp4', 'https://unpkg.com/wot-design-uni-assets@1.0.3/VID_150752.mp4' ])Implement a basic ActionSheet menu
Thewd-action-sheetcomponent provides a menu that slides up from the bottom. Usev-modelto control visibility and theactionsprop to define the menu items. Each action object can include aname,subname(description), andcolor.<wd-button @click="showActions">弹出菜单</wd-button> <wd-action-sheet v-model="show" :actions="actions" @close="close" @select="select" />const show = ref<boolean>(false) const actions = ref([ { name: '选项1' }, { name: '选项2' }, { name: '选项3', subname: '描述信息' } ]) function showActions() { show.value = true } function close() { show.value = false } function select({ item, index }) { console.log(`Selected: ${item.name}, Index: ${index}`) }Implement basic pagination with wd-pagination
Use thewd-paginationcomponent to split large datasets into pages. Bind the current page number usingv-model. The total number of pages is automatically calculated based on thetotal(total number of items) andpage-size(items per page, defaults to 10) properties.<wd-pagination v-model="value" :total="100" :page-size="10" @change="handleChange" />import { ref } from 'vue'; const value = ref<number>(1); function handleChange({ value }) { console.log('Current page:', value); }Install Sass for Wot UI
Wot UI depends onsass. It is critical to use a version of Sass equal to or earlier than1.78.0, as Dart Sass 3.0.0 introduces API changes that are currently incompatible with the component library.npm i sass -D # or yarn add sass -D # or pnpm add sass -DSwitch the active language in Wot UI
Use theLocale.usemethod to switch the current language of the Wot UI components. You must import the corresponding language pack fromwot-design-uni/locale/lang/.import { Locale } from 'wot-design-uni' // Import the English language pack import enUS from 'wot-design-uni/locale/lang/en-US' Locale.use('en-US', enUS)Implement custom icon fonts in wd-icon
To use icons beyond the built-in set, import a third-party iconfont CSS file (containing the@font-faceand specific icon classes) and use theclass-prefixattribute to specify the custom font family class./* src/iconfont/index.css */ @font-face { font-family: "fish"; src: url('//at.alicdn.com/t/c/font_4626013_vwpx4thmin.woff2?t=1721314121733') format('woff2'); } .fish { font-family: "fish" !important; } .fish-kehuishouwu:before { content: "\e627"; }<!-- In app.vue --> <style> @import '@/iconfont/index.css'; </style>
<!-- Usage: class-prefix matches the CSS class 'fish' --> <wd-icon class-prefix="fish" name="kehuishouwu" />