### Configure easycom Rules in pages.json
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/uview-ui/README.md
Configures the easycom rules in pages.json to enable on-demand component loading. This eliminates the need for manual imports. The example shows configurations for both npm and direct download installations.
```js
// pages.json
{
"easycom": {
// npm安装的方式不需要前面的"@/",下载安装的方式需要"@/"
// npm安装方式
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
// 下载安装方式
// "^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
},
// 此为本身已有的内容
"pages": [
// ......
]
}
```
--------------------------------
### Install uView UI via npm
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/uview-ui/README.md
Installs the uView UI library using npm. This command is not required if the library is imported through the plugin market.
```bash
# npm方式安装,插件市场导入无需执行此命令
npm i uview-ui
```
--------------------------------
### Initialize Global Site Configuration (window.SITE_CONFIG)
Source: https://github.com/yx159247/mp_take_out/blob/master/renren-ui/public/index.html
This JavaScript code initializes the `window.SITE_CONFIG` object, which holds global application settings. It defines properties such as application version, environment variables, Vuex store state, content tab defaults, menu lists, permissions, and dynamic routes. API and WebSocket URLs are conditionally set based on the `VUE_APP_NODE_ENV` environment variable, supporting different endpoints for development, SIT, UAT, and production environments.
```JavaScript
window.SITE_CONFIG = {};
window.SITE_CONFIG['version'] = 'v5.0.0';
window.SITE_CONFIG['nodeEnv'] = '<%= process.env.VUE_APP_NODE_ENV %>';
window.SITE_CONFIG['apiURL'] = ''; // api请求地址
window.SITE_CONFIG['storeState'] = {}; // vuex本地储存初始化状态(用于不刷新页面的情况下,也能重置初始化项目中所有状态)
window.SITE_CONFIG['contentTabDefault'] = { // 内容标签页默认属性对象
'name': '', // 名称, 由 this.$route.name 自动赋值(默认,名称 === 路由名称 === 路由路径)
'params': {}, // 参数, 由 this.$route.params 自动赋值
'query': {}, // 查询参数, 由 this.$route.query 自动赋值
'menuId': '', // 菜单id(用于选中侧边栏菜单,与this.$store.state.sidebarMenuActiveName进行匹配)
'title': '', // 标题
'isTab': true, // 是否通过tab展示内容?
'iframeURL': '' // 是否通过iframe嵌套展示内容? (以http[s]://开头, 自动匹配)
};
window.SITE_CONFIG['menuList'] = []; // 左侧菜单列表(后台返回,未做处理)
window.SITE_CONFIG['permissions'] = []; // 页面按钮操作权限(后台返回,未做处理)
window.SITE_CONFIG['dynamicRoutes'] = []; // 动态路由列表
window.SITE_CONFIG['dynamicMenuRoutes'] = []; // 动态(菜单)路由列表
window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] = false; // 动态(菜单)路由是否已经添加的状态标示(用于判断是否需要重新拉取数据并进行动态添加操作)
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/api';
window.SITE_CONFIG['webSocketURL'] = 'ws://localhost:8080/api';
<% } %>
<% if (process.env.VUE_APP_NODE_ENV === 'prod:sit') { %>
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/api';
window.SITE_CONFIG['webSocketURL'] = 'ws://localhost:8080/api';
<% } %>
<% if (process.env.VUE_APP_NODE_ENV === 'prod:uat') { %>
window.SITE_CONFIG['apiURL'] = 'http://localhost:8080/api';
window.SITE_CONFIG['webSocketURL'] = 'ws://localhost:8080/api';
<% } %>
<% if (process.env.VUE_APP_NODE_ENV === 'prod') { %>
window.SITE_CONFIG['apiURL'] = 'https://localhost:8080/api';
window.SITE_CONFIG['webSocketURL'] = 'wss://localhost:8080/api';
<% } %>
```
--------------------------------
### Project Directory Structure Overview
Source: https://github.com/yx159247/mp_take_out/blob/master/README.md
This snippet illustrates the high-level directory structure of the 'take_out' project, detailing the separation of backend services (renren-admin, renren-api), common modules, code generator, and frontend projects (renren-ui for admin, takeout_mp for mini-program). It highlights key modules like job scheduling, logging, file storage, security, system management, and core takeout business logic.
```plaintext
take_out
│
├─renren-admin 美食元素后台管理后端服务
│ │
│ │
│ ├─modules 模块
│ │ ├─job 定时任务
│ │ ├─log 日志管理
│ │ ├─oss 文件存储
│ │ ├─security 安全模块
│ │ ├─sys 系统管理(核心)
| | └─takeout 外卖业务模块(核心)
│ │
│ └─resources
│ ├─mapper MyBatis文件
│ ├─public 静态资源
│ └─application.yml 全局配置文件
│
│
├─renren-api 美食元素小程序后端服务
│
├─renren-common 公共模块
├─renren-generator 代码生成器
│ └─resources
│ ├─mapper MyBatis文件
│ ├─template 代码生成器模板(可增加或修改相应模板)
│ ├─application.yml 全局配置文件
│ └─generator.properties 代码生成器,配置文件
│
├─renren-ui 美食元素后台管理Vue前端项目
├─takeout_mp uniapp微信小程序项目
```
--------------------------------
### Use uView Components Directly with easycom
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/uview-ui/README.md
Once easycom rules are configured in pages.json, uView components can be used directly in templates without requiring explicit import statements, enabling automatic on-demand loading.
```html
```
--------------------------------
### wx-user-info-modal Component Parameters
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/tuniaoui-wx-user-info/readme.md
This section provides documentation for the `wx-user-info-modal` component, detailing its available properties and their purposes.
```APIDOC
Component: wx-user-info-modal
Properties:
v-model:
Description: Controls the visibility of the user information authorization modal (true to show, false to hide).
Type: Boolean
Usage: Used for two-way data binding to manage the modal's open/close state.
```
--------------------------------
### API Documentation Endpoints
Source: https://github.com/yx159247/mp_take_out/blob/master/README.md
This section provides the access points for the API documentation generated by Swagger/Knife4j for both the backend management system and the WeChat mini-program. These URLs allow developers to explore available endpoints, request/response schemas, and test API calls.
```APIDOC
Backend Management System API Documentation:
URL: http://localhost:8080/api/doc.html
Tool: Knife4j (Swagger)
WeChat Mini-Program API Documentation:
URL: http://localhost:8081/api/doc.html
Tool: Knife4j (Swagger)
```
--------------------------------
### Import uView Library in main.js
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/uview-ui/README.md
Imports the uView UI library and registers it as a Vue plugin in the main application entry file (main.js) to make its components globally available.
```js
// main.js
import uView from 'uview-ui';
Vue.use(uView);
```
--------------------------------
### Implement User Authorization Login Page in Uni-app Vue
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/tuniaoui-wx-user-info/readme.md
This snippet demonstrates a Uni-app Vue component for a login page that includes a user authorization modal. It shows how to import and use the `wx-user-info-modal` component, control its visibility with `v-model`, and handle the `updated` event to receive user information. It also includes basic styling for the login page and authorization button.
```Vue
授权登录
```
--------------------------------
### Import Global SCSS Variables in uni.scss
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/uview-ui/README.md
Imports the global SCSS variable file from uView UI into uni.scss. This file contains theme-related variables that can be customized.
```scss
/* uni.scss */
@import "uview-ui/theme.scss";
```
--------------------------------
### Upgrading mescroll to uni_modules version (1.3.5+)
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/mescroll-uni/readme.md
Instructions for users to upgrade their mescroll component to the 1.3.5+ uni_modules version. This process involves removing old component files and registrations, importing the new version, updating import paths, and leveraging easycom compliance for mescroll-empty.
```Plaintext
1. 删除原来的 @/components/mescroll-uni 组件
2. 删除 main.js 注册的 mescroll 组件
3. 从插件市场导入最新mescroll组件 (1.3.5+uni_modules版本)
4. 全局搜索 '@/components/mescroll-uni/' 替换为 '@/uni_modules/mescroll-uni/components/mescroll-uni/'
5. mescroll-empty遵循easycom规范, 若某些页面单独使用 'mescroll-empty.vue', 可删除手动导入的代码
```
--------------------------------
### Dynamically Configure Mobile Viewport for Safe Area Support in JavaScript
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/index.html
This JavaScript snippet detects support for CSS `env()` or `constant()` functions, which are used to define safe areas on mobile devices (e.g., iPhones with notches). Based on this detection, it dynamically injects or updates the `viewport` meta tag to include `viewport-fit=cover`, ensuring the web content correctly utilizes the full screen, including areas under device notches or rounded corners. This is essential for a seamless full-screen experience on modern mobile browsers.
```JavaScript
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write( '')
```
--------------------------------
### Import Base Styles in App.vue
Source: https://github.com/yx159247/mp_take_out/blob/master/takeout_mp/uni_modules/uview-ui/README.md
Imports the core SCSS styles for uView UI into the App.vue component. It is crucial to declare lang="scss" on the
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.