### Install ViewUI using npm Source: https://github.com/view-design/viewui/blob/master/README.md Installs the ViewUI library using npm. This is the recommended method for projects using npm as their package manager. ```bash npm install view-design --save ``` -------------------------------- ### ViewUI Installation and Global Setup in Vue.js Source: https://context7.com/view-design/viewui/llms.txt Demonstrates how to install ViewUI via npm and configure it for global use in a Vue.js application. This includes importing the library, CSS, locale settings, and common configuration options like component size and popup transfer. ```javascript // Install via npm // npm install view-design --save // main.js - Full library import import Vue from 'vue'; import ViewUI from 'view-design'; import 'view-design/dist/styles/iview.css'; import locale from 'view-design/src/locale/lang/en-US'; Vue.use(ViewUI, { locale: locale, size: 'default', // Global component size: 'small', 'default', 'large' transfer: true, // Transfer popup to body capture: true, // Event capture mode select: { arrow: 'ios-arrow-down', customArrow: '', arrowSize: '' } }); // Access global methods // this.$Message, this.$Modal, this.$Notice, this.$Loading, this.$Spin ``` -------------------------------- ### Install ViewUI using a script tag Source: https://github.com/view-design/viewui/blob/master/README.md Includes ViewUI globally in an HTML page using script and link tags. This is suitable for projects not using a module bundler or for quick prototyping. ```html ``` -------------------------------- ### Vue.js Grid System Examples Source: https://context7.com/view-design/viewui/llms.txt Demonstrates the usage of ViewUI's Row and Col components for creating responsive grid layouts. Supports basic structure, gutters, offsets, push/pull, responsive columns, alignment, and ordering. No external dependencies are required beyond Vue.js itself. ```vue ``` -------------------------------- ### View UI Select Component Examples (Vue) Source: https://context7.com/view-design/viewui/llms.txt Demonstrates various configurations of the View UI Select component, including basic usage, multiple selections, filtering, remote data fetching, option grouping, and size variations. It utilizes Vue.js for templating and script logic. ```vue ``` -------------------------------- ### View UI DatePicker Component Examples Source: https://context7.com/view-design/viewui/llms.txt Demonstrates various ways to use the DatePicker component in Vue.js for selecting dates, date ranges, datetimes, months, and years. It shows basic usage, custom formatting, disabling dates, and integrating with TimePicker. ```vue ``` -------------------------------- ### ViewUI Button Component Examples Source: https://context7.com/view-design/viewui/llms.txt Illustrates the usage of the ViewUI Button component in a Vue.js template. It covers various button types (default, primary, dashed, etc.), sizes (small, default, large), states (loading, disabled, ghost), icon integration, button groups, router links, and click event handling. ```vue ``` -------------------------------- ### View UI Input Component Examples Source: https://context7.com/view-design/viewui/llms.txt Demonstrates the usage of the View UI Input component for various input types, sizes, and functionalities. Includes basic input, inputs with icons, different sizes, password fields, textareas (including auto-sizing), inputs with prepended/appended content, prefix/suffix icons, search functionality, clearable inputs, disabled inputs, and inputs with event handlers. This component is built using Vue.js. ```vue ``` -------------------------------- ### View UI Message Component: Notifications and Feedback (JavaScript) Source: https://context7.com/view-design/viewui/llms.txt Illustrates the usage of the View UI Message component for displaying user feedback. It includes examples for basic info, success, warning, and error messages, as well as loading states and advanced configuration options like duration, closability, and background. Global configuration and destruction are also covered. This code is typically used within a Vue.js application context. ```javascript // Global message methods available on this.$Message // Basic usage this.$Message.info('This is an info message'); this.$Message.success('Operation completed successfully!'); this.$Message.warning('Warning: Please check your input'); this.$Message.error('Error: Operation failed'); // Loading message const hide = this.$Message.loading('Processing your request...'); setTimeout(() => { hide(); // Manually close loading message this.$Message.success('Request completed!'); }, 3000); // Advanced configuration this.$Message.info({ content: 'Custom message with options', duration: 5, // Display duration in seconds (0 = permanent) closable: true, // Show close button background: true, // Add background color onClose: () => { console.log('Message closed'); } }); // Global configuration this.$Message.config({ top: 50, // Distance from top in pixels duration: 3 // Default duration }); // Destroy all messages this.$Message.destroy(); ``` -------------------------------- ### View UI LoadingBar: Control Page Transitions and Async Operations Source: https://context7.com/view-design/viewui/llms.txt The LoadingBar component provides a visual progress indicator for page transitions and asynchronous operations. It can be controlled globally via `this.$Loading` or integrated with routing and network requests like Axios. Dependencies include Vue.js and View UI. It accepts methods like `start()`, `update()`, `finish()`, `error()`, and `config()` for customization. ```javascript // Global loading bar available on this.$Loading // Start loading this.$Loading.start(); // Update progress (0-100) this.$Loading.update(50); // Finish loading (success) this.$Loading.finish(); // Finish loading (error) this.$Loading.error(); // Configuration this.$Loading.config({ color: '#5cb85c', // Bar color failedColor: '#f0ad4e', // Error color height: 2 // Bar height in pixels }); // Example: Use with router import Vue from 'vue'; import Router from 'vue-router'; import ViewUI from 'view-design'; Vue.use(ViewUI); const router = new Router({ /* routes */ }); router.beforeEach((to, from, next) => { ViewUI.LoadingBar.start(); next(); }); router.afterEach(() => { ViewUI.LoadingBar.finish(); }); // Example: Use with axios import axios from 'axios'; axios.interceptors.request.use(config => { Vue.prototype.$Loading.start(); return config; }, error => { Vue.prototype.$Loading.error(); return Promise.reject(error); }); axios.interceptors.response.use(response => { Vue.prototype.$Loading.finish(); return response; }, error => { Vue.prototype.$Loading.error(); return Promise.reject(error); }); ``` -------------------------------- ### Vue.js Data Table with Sorting, Filtering, and Pagination Source: https://context7.com/view-design/viewui/llms.txt This Vue.js component demonstrates the usage of the View UI Table and Page components to create a functional data table. It includes configurations for columns, data, loading states, sorting, filtering, selection, and pagination. The example covers event handling for user interactions and basic modal/message confirmations for actions. ```vue ``` -------------------------------- ### View UI Notice Component Usage Source: https://context7.com/view-design/viewui/llms.txt Illustrates how to use the Notice component in JavaScript for displaying various types of notifications like info, success, warning, and error. It covers basic usage, advanced configurations such as duration, closability, and custom render functions, as well as global configuration and closing specific notices. ```javascript // Global notice methods available on this.$Notice // Basic usage this.$Notice.info({ title: 'Notification Title', desc: 'This is the notification description.' }); this.$Notice.success({ title: 'Success', desc: 'Your operation completed successfully.' }); this.$Notice.warning({ title: 'Warning', desc: 'Please check your input and try again.' }); this.$Notice.error({ title: 'Error', desc: 'An error occurred while processing your request.' }); // Advanced configuration this.$Notice.info({ title: 'New Message', desc: 'You have received a new message from John.', duration: 0, // 0 = permanent until manually closed closable: true, // Show close button (default: true) onClose: () => { console.log('Notice closed'); } }); // With custom render function this.$Notice.open({ title: 'Custom Content', render: h => { return h('div', [ h('p', 'This is custom HTML content'), h('Button', { props: { type: 'primary' }, on: { click: () => { console.log('Button clicked'); } } }, 'Action') ]); } }); // Global configuration this.$Notice.config({ top: 24, // Distance from top in pixels duration: 4.5 // Default duration in seconds }); // Close specific notice const notice = this.$Notice.info({ title: 'Processing...', desc: 'Please wait' }); setTimeout(() => { this.$Notice.close('notice_key'); }, 3000); // Destroy all notices this.$Notice.destroy(); ``` -------------------------------- ### View UI Layout: Structure Applications with Header, Content, and Sidebar Source: https://context7.com/view-design/viewui/llms.txt The Layout component offers a flexible grid system for structuring application UIs, including Header, Content, Footer, and Sider areas. It supports basic layouts, layouts with sidebars, and collapsible sidebars. This Vue.js template demonstrates common usage patterns. ```vue ``` -------------------------------- ### Vue Component Usage with ViewUI Slider Source: https://github.com/view-design/viewui/blob/master/README.md Demonstrates how to use the Slider component from ViewUI within a Vue.js template and script. It shows basic range slider implementation. ```vue ``` -------------------------------- ### Import ViewUI CSS via JavaScript Source: https://github.com/view-design/viewui/blob/master/README.md Imports the ViewUI CSS file directly into your JavaScript or Vue component. This is useful when using a module bundler like Webpack or Vite. ```javascript import 'view-design/dist/styles/iview.css'; ``` -------------------------------- ### View UI Modal Component: Declarative and Programmatic Usage (Vue) Source: https://context7.com/view-design/viewui/llms.txt Demonstrates how to use the View UI Modal component in Vue.js. It covers declarative usage within the template for custom content and programmatic usage via `$Modal.info` and `$Modal.confirm` for standard dialogs. Dependencies include Vue.js and the View UI library. ```vue ``` -------------------------------- ### Vue.js Form Component with Validation and Data Binding Source: https://context7.com/view-design/viewui/llms.txt This Vue.js component demonstrates a complete form system using View UI components. It includes fields for username, email, password, city selection, gender, interests, and a description textarea. It features built-in validation rules for required fields, length constraints, and email format, along with submit and reset functionalities. ```vue ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.