### Install uView UI via npm - bash
Source: https://github.com/umicro/uview/blob/master/uview-ui/README.md
Provides the command-line instruction to install the uView UI framework using the npm package manager. This is the standard and recommended way to add uView as a dependency to your uni-app project.
```bash
npm i uview-ui
```
--------------------------------
### Configure easycom for Auto Import in pages.json - JSON
Source: https://github.com/umicro/uview/blob/master/uview-ui/README.md
Explains how to set up the `easycom` feature in `pages.json` to enable automatic component import for uView components. By defining a rule like `^u-(.*)`, uni-app automatically imports the corresponding uView component (`u-$1`) when it's used in a template, eliminating manual import statements. Includes examples for both npm and download installations.
```json
// pages.json
{
"easycom": {
// npm安装的方式不需要前面的"@/",下载安装的方式需要"@/"
// npm安装方式
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
// 下载安装方式
// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
// 此为本身已有的内容
"pages": [
// ......
]
}
```
--------------------------------
### Configuring uView Easycom Rule in pages.json
Source: https://github.com/umicro/uview/blob/master/README.md
This JSON configuration block, added to the `pages.json` file, sets up the `easycom` feature for uView components. It defines a rule (`^u-(.*)`) that automatically imports uView components (prefixed with `u-`) without requiring manual import statements in each `.vue` file. It shows rules for both downloaded and npm installations.
```json
// pages.json
{
"easycom": {
// 下载安装的方式需要前面的"@/",npm安装的方式无需"@/"
// 下载安装方式
"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
// npm安装方式
// "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
// 此为本身已有的内容
"pages": [
// ......
]
}
```
--------------------------------
### Using u-button Component in Template - Vue
Source: https://github.com/umicro/uview/blob/master/uview-ui/README.md
Provides a simple example of how to use a uView component (specifically `u-button`) directly within a Vue template after the `easycom` configuration is applied. This highlights the convenience of the auto-import feature, allowing components to be used without explicit `import` or `components` declarations.
```html
按钮
```
--------------------------------
### Initialize uView UI in main.js - JavaScript
Source: https://github.com/umicro/uview/blob/master/uview-ui/README.md
Demonstrates how to import the uView library and register it as a Vue plugin within the project's main entry file (`main.js`). This step makes uView components, directives, and prototype methods available throughout your uni-app application.
```javascript
// main.js
import uView from 'uview-ui';
Vue.use(uView);
```
--------------------------------
### Import Global Variables in uni.scss - SCSS
Source: https://github.com/umicro/uview/blob/master/uview-ui/README.md
Illustrates importing the uView UI theme variables and global SCSS helpers into the `uni.scss` file. This allows you to easily customize theme colors, sizes, and other variables, as well as use uView's mixins and functions globally within your project.
```css
/* uni.scss */
@import "uview-ui/theme.scss";
```
--------------------------------
### Registering uView Library in Vue
Source: https://github.com/umicro/uview/blob/master/README.md
This JavaScript snippet, typically found in `main.js`, imports the uView library and registers it globally with the Vue instance using `Vue.use()`. This step makes all uView components, directives, and utilities available throughout the uni-app project.
```javascript
// main.js
import uView from 'uview-ui';
Vue.use(uView);
```
--------------------------------
### Using uView Component with Easycom
Source: https://github.com/umicro/uview/blob/master/README.md
This HTML/Vue template snippet demonstrates how to use a uView component (`u-button`) directly in a template after the `easycom` rule has been configured in `pages.json`. With `easycom`, you don't need to explicitly import or register the component in the script block.
```html
按钮
```
--------------------------------
### Import Base Styles in App.vue - SCSS
Source: https://github.com/umicro/uview/blob/master/uview-ui/README.md
Shows how to import the core uView UI SCSS styles into the global `App.vue` component. Including the base styles here ensures that essential styling for all uView components is applied application-wide. Requires configuring SCSS support in your project.
```css
/* App.vue */
```
--------------------------------
### Importing uView Global Theme Variables
Source: https://github.com/umicro/uview/blob/master/README.md
This SCSS snippet, added to `uni.scss`, imports the global theme variables defined by uView. This file is used for project-wide styles and variables in uni-app. Importing the theme variables allows for easy customization of uView's look and feel by overriding these variables in your project's `uni.scss`.
```scss
/* uni.scss */
@import "uview-ui/theme.scss";
```
--------------------------------
### Importing uView Base Styles in App.vue
Source: https://github.com/umicro/uview/blob/master/README.md
This SCSS snippet, placed within a `
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.