### Install and Configure uView Next for Vue 2 and Vue 3 Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates how to install and globally configure the uView Next framework in your uni-app project for both Vue 3 and Vue 2 environments. This setup enables the use of uView components and utilities throughout your application. ```javascript // main.js import uviewNext from '@/uni_modules/uview-next'; // Vue 3 setup import { createSSRApp } from 'vue'; export function createApp() { const app = createSSRApp(App); app.use(uviewNext); return { app }; } // Vue 2 setup import Vue from 'vue'; Vue.use(uviewNext); ``` -------------------------------- ### Initialize Touch Event Emulation Source: https://github.com/yeloa/uview-next/blob/master/index.html Initializes the TouchEmulator functionality. This is typically used in development or testing environments to simulate touch events on devices that do not natively support them, allowing for easier frontend development and debugging. ```javascript TouchEmulator() ``` -------------------------------- ### u-button Component Examples for uView Next Source: https://context7.com/yeloa/uview-next/llms.txt Illustrates various configurations and styles for the u-button component in uView Next. This includes examples of different button types, sizes, states (loading, disabled), shapes, and the usage of icons and custom gradient colors. ```html ``` -------------------------------- ### Video Upload Configuration with u-upload Source: https://context7.com/yeloa/uview-next/llms.txt Shows how to configure the u-upload component specifically for video uploads. This example sets the `accept` attribute to 'video', limits the upload to a single file (`maxCount='1'`), and specifies a maximum duration for the video. It uses the `afterVideoRead` handler for processing selected videos. ```html ``` -------------------------------- ### Configure Viewport Meta Tag with CSS Cover Support Source: https://github.com/yeloa/uview-next/blob/master/index.html This script dynamically generates a viewport meta tag. It checks for CSS `supports` function and `env()` or `constant()` properties to determine if viewport-fit=cover should be included, optimizing for devices with notches or cutouts. ```javascript var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) document.write( '') ``` -------------------------------- ### Configure and Use HTTP Client (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Configures and demonstrates the usage of a feature-rich HTTP client with request/response interceptors. It allows setting base configurations, adding authentication tokens, and handling API responses and errors. Supports all HTTP methods including GET, POST, PUT, DELETE, and file uploads. ```javascript // Configure HTTP client in a separate file (e.g., common/http.js) const http = uni.$u.http; // Set base configuration http.setConfig(config => { config.baseURL = 'https://api.example.com'; config.timeout = 30000; config.header = { 'Content-Type': 'application/json' }; return config; }); // Request interceptor - add auth token http.interceptors.request.use(config => { const token = uni.getStorageSync('token'); if (token) { config.header.Authorization = `Bearer ${token}`; } return config; }, error => { return Promise.reject(error); }); // Response interceptor - handle errors http.interceptors.response.use(response => { const { data } = response; if (data.code === 200) { return data.data; } else if (data.code === 401) { uni.navigateTo({ url: '/pages/login/login' }); return Promise.reject(data); } uni.$u.toast(data.message || 'Request failed'); return Promise.reject(data); }, error => { uni.$u.toast('Network error'); return Promise.reject(error); }); // Usage examples export default { methods: { // GET request async fetchUsers() { try { const users = await uni.$u.http.get('/users', { page: 1, limit: 10 }); console.log('Users:', users); } catch (error) { console.error('Error:', error); } }, // POST request async createUser() { try { const result = await uni.$u.http.post('/users', { name: 'John Doe', email: 'john@example.com' }); console.log('Created:', result); } catch (error) { console.error('Error:', error); } }, // PUT request async updateUser(id) { try { const result = await uni.$u.http.put(`/users/${id}`, { name: 'Jane Doe' }); console.log('Updated:', result); } catch (error) { console.error('Error:', error); } }, // DELETE request async deleteUser(id) { try { await uni.$u.http.delete(`/users/${id}`); console.log('Deleted'); } catch (error) { console.error('Error:', error); } }, // File upload async uploadFile(filePath) { try { const result = await uni.$u.http.upload('/upload', { filePath: filePath, name: 'file', formData: { type: 'avatar' } }); console.log('Uploaded:', result); } catch (error) { console.error('Error:', error); } } } }; ``` -------------------------------- ### Custom Slot Content Modal using u-modal Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates how to use slots to inject custom content into the modal body. This example includes a u-input component within the modal, allowing for user input. ```html ``` -------------------------------- ### Basic Image Upload with u-upload Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates a basic image upload setup using the u-upload component. It configures the component to accept images, sets a maximum count, and defines event handlers for file reading and deletion. The component relies on the `afterRead` and `delete` event handlers for managing uploaded files. ```html ``` -------------------------------- ### Page and System Information Utilities (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Offers utilities to retrieve the current page's path, access all active page instances, get the previous page instance, and detect the operating system or system information. These are useful for navigation, debugging, and adapting application behavior based on the environment. ```javascript // Get current page path uni.$u.page(); // "/pages/index/index" uni.$u.pages(); // Array of all page instances uni.$u.getHistoryPage(-1); // Previous page instance // Platform detection uni.$u.os(); // "ios" or "android" or "devtools" uni.$u.sys(); // Full system info object ``` -------------------------------- ### Perform Router Navigation (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Provides a simplified utility for page navigation with support for various navigation types like navigateTo, redirectTo, switchTab, reLaunch, and navigateBack. It also allows passing parameters and configuring animation effects. Includes an example of route interception for conditional navigation. ```javascript // Simple navigation uni.$u.route('/pages/user/profile'); // Navigation with parameters uni.$u.route('/pages/product/detail', { id: 123, name: 'iPhone' }); // Navigation with full options uni.$u.route({ type: 'navigateTo', // navigateTo, redirectTo, switchTab, reLaunch, navigateBack url: '/pages/order/list', params: { status: 'pending' }, animationType: 'slide-in-right', // APP only animationDuration: 300 }); // Redirect (replace current page) uni.$u.route({ type: 'redirectTo', url: '/pages/login/login' }); // Switch to tab page uni.$u.route({ type: 'switchTab', url: '/pages/home/index' }); // Navigate back uni.$u.route({ type: 'navigateBack', delta: 1 // Number of pages to go back }); // Relaunch app uni.$u.route({ type: 'reLaunch', url: '/pages/index/index' }); // Route interception uni.$u.routeIntercept = (config, resolve) => { const token = uni.getStorageSync('token'); const protectedPages = ['/pages/user/profile', '/pages/order/list']; if (protectedPages.includes(config.url) && !token) { uni.$u.toast('Please login first'); uni.$u.route('/pages/login/login'); resolve(false); // Block navigation } else { resolve(true); // Allow navigation } }; ``` -------------------------------- ### Custom Upload Button Styling with u-upload Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates how to customize the appearance and text of the upload button using u-upload. This example sets custom width, height, upload icon, icon color, and button text to create a more integrated user experience. The `afterRead` handler is used to process the files selected via the custom button. ```html ``` -------------------------------- ### Calendar Component Usage (Vue) Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates the usage of the u-calendar component for single, multiple, and range date selections. It includes examples of basic configuration, custom date formatting, and event handling for selection confirmation and closing the calendar. ```html ``` -------------------------------- ### Nested Property Access and Modification (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Provides functions to safely get and set properties within nested JavaScript objects using dot notation strings. This simplifies accessing deeply nested data and modifying it without needing to check for the existence of intermediate properties. ```javascript // Get/set nested properties const obj = { user: { profile: { name: 'John' } } }; uni.$u.getProperty(obj, 'user.profile.name'); // "John" uni.$u.setProperty(obj, 'user.profile.age', 25); // Sets nested property ``` -------------------------------- ### u-input Component with Icons Source: https://context7.com/yeloa/uview-next/llms.txt Shows how to add prefix and suffix icons to the u-input component to provide visual cues or actions related to the input field. ```html ``` -------------------------------- ### Basic u-input Component Usage Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates the fundamental usage of the u-input component for capturing text input. It utilizes v-model for data binding and a placeholder for user guidance. ```html ``` -------------------------------- ### Unit and Style Conversion Utilities (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Includes functions to add CSS units to numbers, convert various unit formats (like rpx) to pixels, and transform styles between object and string formats. These are useful for dynamic styling and ensuring consistent unit handling in UI development. ```javascript // Add CSS unit uni.$u.addUnit(100); // "100px" uni.$u.addUnit('100rpx'); // "100rpx" (unchanged) uni.$u.addUnit('auto'); // "auto" (unchanged) // Convert px values uni.$u.getPx('100rpx'); // Converted px value uni.$u.getPx(100); // 100 uni.$u.getPx(100, true); // "100px" (with unit) // Style conversion (object <-> string) uni.$u.addStyle('color: red; font-size: 14px', 'object'); // Result: { color: 'red', 'font-size': '14px' } uni.$u.addStyle({ color: 'red', fontSize: '14px' }, 'string'); // Result: "color:red;font-size:14px;" ``` -------------------------------- ### Image Compression Configuration with u-upload Source: https://context7.com/yeloa/uview-next/llms.txt Shows how to enable image compression directly within the u-upload component. The `compressImage` prop is used to specify compression quality and target width, reducing file size before upload. The `afterRead` handler is responsible for processing the compressed image files. ```html ``` -------------------------------- ### HTTP Request (uni.$u.http) Source: https://context7.com/yeloa/uview-next/llms.txt A comprehensive HTTP client for making requests with support for interceptors, configuration, and various HTTP methods. ```APIDOC ## HTTP Request (uni.$u.http) ### Description A feature-rich HTTP client with request/response interceptors, automatic configuration merging, and support for all HTTP methods. ### Configuration Configure the HTTP client by setting `baseURL`, `timeout`, and `header`. ```javascript const http = uni.$u.http; http.setConfig(config => { config.baseURL = 'https://api.example.com'; config.timeout = 30000; config.header = { 'Content-Type': 'application/json' }; return config; }); ``` ### Interceptors #### Request Interceptor Used to modify request configurations before they are sent, such as adding authentication tokens. ```javascript http.interceptors.request.use(config => { const token = uni.getStorageSync('token'); if (token) { config.header.Authorization = `Bearer ${token}`; } return config; }, error => { return Promise.reject(error); }); ``` #### Response Interceptor Used to handle responses, including success data, authentication errors, and general request failures. ```javascript http.interceptors.response.use(response => { const { data } = response; if (data.code === 200) { return data.data; } else if (data.code === 401) { uni.navigateTo({ url: '/pages/login/login' }); return Promise.reject(data); } uni.$u.toast(data.message || 'Request failed'); return Promise.reject(data); }, error => { uni.$u.toast('Network error'); return Promise.reject(error); }); ``` ### Usage Examples #### GET Request ```javascript // GET request async fetchUsers() { try { const users = await uni.$u.http.get('/users', { page: 1, limit: 10 }); console.log('Users:', users); } catch (error) { console.error('Error:', error); } } ``` #### POST Request ```javascript // POST request async createUser() { try { const result = await uni.$u.http.post('/users', { name: 'John Doe', email: 'john@example.com' }); console.log('Created:', result); } catch (error) { console.error('Error:', error); } } ``` #### PUT Request ```javascript // PUT request async updateUser(id) { try { const result = await uni.$u.http.put(`/users/${id}`, { name: 'Jane Doe' }); console.log('Updated:', result); } catch (error) { console.error('Error:', error); } } ``` #### DELETE Request ```javascript // DELETE request async deleteUser(id) { try { await uni.$u.http.delete(`/users/${id}`); console.log('Deleted'); } catch (error) { console.error('Error:', error); } } ``` #### File Upload ```javascript // File upload async uploadFile(filePath) { try { const result = await uni.$u.http.upload('/upload', { filePath: filePath, name: 'file', formData: { type: 'avatar' } }); console.log('Uploaded:', result); } catch (error) { console.error('Error:', error); } } ``` ``` -------------------------------- ### u-swiper with Custom Data Key Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates how to use a custom key name when the input list for u-swiper contains objects instead of simple image URLs. This is useful for mapping specific properties (e.g., 'image') from complex data structures. ```html ``` -------------------------------- ### u-input Component with Different Input Types Source: https://context7.com/yeloa/uview-next/llms.txt Shows how to configure the u-input component for specific input types like numbers, ID cards, and decimal amounts. This enhances user experience and data validation. ```html ``` -------------------------------- ### Basic Alert Modal using u-modal Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates a simple alert modal that displays a message and closes when confirmed. It uses the 'show', 'title', and 'content' props, and listens for the 'confirm' event. ```html ``` -------------------------------- ### u-input Component for Password Input Source: https://context7.com/yeloa/uview-next/llms.txt Illustrates the use of the u-input component for password fields, including the built-in functionality to toggle password visibility. ```html ``` -------------------------------- ### Color Conversion Utilities (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Includes functions for converting colors between different formats, such as HEX to RGB, RGB to HEX, and HEX to RGBA with an alpha value. It also offers a function to generate a gradient of colors between two specified colors. ```javascript // Color utilities uni.$u.hexToRgb('#ff0000'); // "rgb(255, 0, 0)" uni.$u.rgbToHex('rgb(255, 0, 0)'); // "#ff0000" uni.$u.colorToRgba('#ff0000', 0.5); // "rgba(255, 0, 0, 0.5)" uni.$u.colorGradient('#ff0000', '#0000ff', 5); // Array of gradient colors ``` -------------------------------- ### u-input Component with Border Styles Source: https://context7.com/yeloa/uview-next/llms.txt Explains the different border styles available for the u-input component, including 'surround', 'bottom', and 'none', to control the visual appearance of the input field. ```html ``` -------------------------------- ### Router Navigation (uni.$u.route) Source: https://context7.com/yeloa/uview-next/llms.txt A simplified routing utility for page navigation with support for various navigation types and interception. ```APIDOC ## Router Navigation (uni.$u.route) ### Description A simplified routing utility with navigation interception support for cleaner page navigation code. ### Basic Navigation Navigate to a specified page. ```javascript // Simple navigation uni.$u.route('/pages/user/profile'); ``` ### Navigation with Parameters Navigate to a page and pass query parameters. ```javascript // Navigation with parameters uni.$u.route('/pages/product/detail', { id: 123, name: 'iPhone' }); ``` ### Navigation with Full Options Navigate using a configuration object to specify navigation type, URL, parameters, and animation. ```javascript // Navigation with full options uni.$u.route({ type: 'navigateTo', // navigateTo, redirectTo, switchTab, reLaunch, navigateBack url: '/pages/order/list', params: { status: 'pending' }, animationType: 'slide-in-right', // APP only animationDuration: 300 }); ``` ### Specific Navigation Types #### Redirect To Replace the current page with the new page. ```javascript // Redirect (replace current page) uni.$u.route({ type: 'redirectTo', url: '/pages/login/login' }); ``` #### Switch Tab Navigate to a tab bar page. ```javascript // Switch to tab page uni.$u.route({ type: 'switchTab', url: '/pages/home/index' }); ``` #### Navigate Back Go back to a previous page. ```javascript // Navigate back uni.$u.route({ type: 'navigateBack', delta: 1 // Number of pages to go back }); ``` #### ReLaunch Close all existing pages and open the specified page. ```javascript // Relaunch app uni.$u.route({ type: 'reLaunch', url: '/pages/index/index' }); ``` ### Route Interception Intercept navigation requests to perform checks or modifications before navigation occurs. ```javascript uni.$u.routeIntercept = (config, resolve) => { const token = uni.getStorageSync('token'); const protectedPages = ['/pages/user/profile', '/pages/order/list']; if (protectedPages.includes(config.url) && !token) { uni.$u.toast('Please login first'); uni.$u.route('/pages/login/login'); resolve(false); // Block navigation } else { resolve(true); // Allow navigation } }; ``` ``` -------------------------------- ### Handling File Uploads and Server Communication (Vue.js) Source: https://context7.com/yeloa/uview-next/llms.txt Provides the Vue.js script for handling file uploads initiated by the u-upload component. It includes methods for processing files after they are read (`afterRead`), uploading them to a server using `uni.uploadFile`, and updating the UI based on upload status (success or failure). Error handling for the upload process is also included. ```javascript export default { data() { return { imageList: [], videoList: [], fileList: [], customList: [], compressedList: [] }; }, methods: { afterRead(event) { const { file } = event; const fileList = Array.isArray(file) ? file : [file]; fileList.forEach(item => { this.imageList.push({ url: item.url, status: 'uploading', message: 'Uploading...' }); }); // Upload to server this.uploadToServer(fileList); }, async uploadToServer(files) { for (let i = 0; i < files.length; i++) { try { const result = await uni.uploadFile({ url: 'https://api.example.com/upload', filePath: files[i].url, name: 'file', header: { Authorization: `Bearer ${uni.getStorageSync('token')}` } }); const data = JSON.parse(result.data); const index = this.imageList.length - files.length + i; this.imageList[index].status = 'success'; this.imageList[index].url = data.url; } catch (error) { const index = this.imageList.length - files.length + i; this.imageList[index].status = 'failed'; this.imageList[index].message = 'Upload failed'; } } }, handleDelete(event) { this.imageList.splice(event.index, 1); } } }; ``` -------------------------------- ### u-input Component Shape Variants Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates how to apply different shape variants, such as 'circle', to the u-input component for distinct visual styling. ```html ``` -------------------------------- ### Tabs Component Usage (Vue) Source: https://context7.com/yeloa/uview-next/llms.txt Illustrates the implementation of the u-tabs component for various use cases, including basic tab navigation, scrollable tabs, custom styling, and tabs with badges. It shows how to manage the active tab and handle click events. ```html ``` -------------------------------- ### u-input Component with Clearable Functionality Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates how to enable a clear button on the u-input component, allowing users to easily remove input text. ```html ``` -------------------------------- ### Multi-File Type Upload with u-upload Source: https://context7.com/yeloa/uview-next/llms.txt Illustrates the u-upload component's capability to handle multiple file types, including specific document extensions. The `accept` attribute is set to 'all', and the `extension` attribute is used to filter allowed file types like PDF and DOC. The `afterFileRead` handler manages the processing of these diverse files. ```html ``` -------------------------------- ### Async Close Modal using u-modal Source: https://context7.com/yeloa/uview-next/llms.txt Illustrates a modal that supports asynchronous closing after an operation completes. The 'asyncClose' prop is used, and the 'confirm' event handler simulates an async task before closing the modal and showing a toast. ```html ``` -------------------------------- ### Styled Modal using u-modal Source: https://context7.com/yeloa/uview-next/llms.txt Presents a modal with custom styling applied to its appearance, including colors for confirm and cancel buttons, border-radius for buttons and the modal itself, and a specific width. ```html ``` -------------------------------- ### u-input Component with Custom Formatting Source: https://context7.com/yeloa/uview-next/llms.txt Shows how to use a custom formatter function with the u-input component to automatically format user input, such as phone numbers. ```html ``` -------------------------------- ### u-swiper with Indicators and Autoplay Source: https://context7.com/yeloa/uview-next/llms.txt Configures the u-swiper component to display pagination indicators (lines) and enable automatic playback of slides. It also supports circular mode for continuous looping. ```html ``` -------------------------------- ### URL Query Parameter Generation (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt A utility function to easily construct query parameter strings for URLs from JavaScript objects. It supports basic key-value pairs, arrays, and options to include or exclude the leading question mark, and use bracket notation for array parameters. ```javascript // Query params uni.$u.queryParams({ a: 1, b: 2 }); // "?a=1&b=2" uni.$u.queryParams({ a: 1, b: 2 }, false); // "a=1&b=2" uni.$u.queryParams({ ids: [1, 2, 3] }, true, 'brackets'); // "?ids[]=1&ids[]=2&ids[]=3" ``` -------------------------------- ### u-swiper with Custom Height, Interval, and Duration Source: https://context7.com/yeloa/uview-next/llms.txt Allows customization of the u-swiper component's visual and playback behavior, including setting a fixed height, adjusting the auto-play interval, and controlling the transition duration between slides. ```html ``` -------------------------------- ### Price Formatting Utility (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Formats numerical values into currency strings with specified decimal places and custom thousand/decimal separators. This function is ideal for displaying prices and financial data in a user-friendly and localized format. ```javascript // Price formatting uni.$u.priceFormat(1234567.89, 2); // "1,234,567.89" uni.$u.priceFormat(1234567.89, 2, '.', ','); // "1,234,567.89" ``` -------------------------------- ### Basic u-swiper Image Carousel Source: https://context7.com/yeloa/uview-next/llms.txt Demonstrates the fundamental usage of the u-swiper component to display a list of images in a carousel format. It accepts an array of image URLs and handles click events on individual slides. ```html ``` -------------------------------- ### Asynchronous Delay and String Trimming (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Provides an asynchronous sleep function to pause execution for a specified duration, useful for timing operations or simulating network latency. Also includes a trim function for removing whitespace from strings, with options to trim from the left, right, or both sides. ```javascript // Sleep/delay await uni.$u.sleep(1000); // Pause for 1 second // Trim strings uni.$u.trim(' hello '); // "hello" (both sides) uni.$u.trim(' hello ', 'left'); // "hello " uni.$u.trim(' hello ', 'right'); // " hello" uni.$u.trim(' hello ', 'all'); // "hello" (all spaces) ``` -------------------------------- ### Vue.js Form Template and Script with u-form Source: https://context7.com/yeloa/uview-next/llms.txt This snippet demonstrates the structure of a Vue.js template using the u-form component for creating a form with various input fields and validation rules. It includes the corresponding script section for data management, rule definition, and method implementations for form submission and reset. ```html ``` -------------------------------- ### u-input Component Disabled and Readonly States Source: https://context7.com/yeloa/uview-next/llms.txt Illustrates how to set the u-input component to disabled or readonly states, preventing user interaction or modification of the input value. ```html ``` -------------------------------- ### Confirm Modal with Cancel Button using u-modal Source: https://context7.com/yeloa/uview-next/llms.txt Shows a confirmation modal with both confirm and cancel buttons. It utilizes the 'showCancelButton' prop and handles both 'confirm' and 'cancel' events for user interaction. ```html ``` -------------------------------- ### ID Generation and Randomization Utilities (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Offers functions to generate universally unique identifiers (UUIDs) with customizable lengths and prefixes, generate random numbers within a specified range, and shuffle array elements randomly. These are helpful for creating unique keys, randomizing data, and ensuring variety in applications. ```javascript // Generate UUID uni.$u.guid(); // "u1234567890abcdef..." (32 chars, starts with 'u') uni.$u.guid(16); // 16-character UUID uni.$u.guid(32, false); // Without 'u' prefix // Random number in range uni.$u.random(1, 100); // Random number between 1 and 100 // Shuffle array uni.$u.randomArray([1, 2, 3, 4, 5]); // Randomly shuffled array ``` -------------------------------- ### Debounce and Throttle Functions (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Implements debounce and throttle utilities to control the rate at which functions are executed. Debounce delays execution until after a certain time has passed without calls, while throttle ensures a function is called at most once within a specified interval. ```javascript // Debounce and throttle const debouncedFn = uni.$u.debounce(() => console.log('debounced'), 300); const throttledFn = uni.$u.throttle(() => console.log('throttled'), 300); ``` -------------------------------- ### Toast Notification Shortcut (JavaScript) Source: https://context7.com/yeloa/uview-next/llms.txt Provides a convenient shortcut function for displaying toast messages to the user. It allows for simple text messages or more customized toasts with options for icons and duration. ```javascript // Toast shortcut uni.$u.toast('Message displayed'); uni.$u.toast('Success', { icon: 'success', duration: 2000 }); ``` -------------------------------- ### u-swiper with Card Style and Custom Margins Source: https://context7.com/yeloa/uview-next/llms.txt Implements a card-like appearance for the u-swiper component by setting custom previous and next margins. This allows for a visually distinct carousel effect, often used for banners or featured content. ```html ```