### Install Dependencies and Start Development Server
Source: https://github.com/suning-cloud-team/uxcool/blob/master/packages/v-table/README.md
Commands to install project dependencies using yarn and to start the development server. Ensure Node.js and Yarn are installed on your system.
```bash
yarn
yarn start
```
--------------------------------
### UXCOOl Cascader Component Examples (Vue)
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates various configurations of the UXCOOl Cascader component in Vue.js. Includes basic setup, search, selecting any level, custom field names, and asynchronous data loading. Assumes the 'ux-cascader' component is available.
```vue
```
--------------------------------
### Install UXCool Component Library
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Instructions for installing the UXCool component library using npm or yarn package managers. This is the first step to integrating UXCool into your Vue project.
```bash
# Install via npm
npm install @cloud-sn/uxcool --save
# Or via yarn
yarn add @cloud-sn/uxcool
```
--------------------------------
### UXCool Grid System Examples (Vue)
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates the usage of the UXCool grid system for layout creation. It includes basic grid, grids with gutters, responsive grids, flex layouts, and offset configurations. This component relies on Vue.js for rendering.
```vue
Col-12
Col-12
Col-6
Col-6
Col-6
Col-6
Responsive
Responsive
Col-4
Col-4
Col-4
Col-8
Col-8 Offset-8
```
--------------------------------
### Full Import and Setup of UXCool in Vue
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates how to perform a full import of the UXCool library and its CSS in a Vue application. This method makes all components available globally after calling Vue.use().
```javascript
// Full import
import Vue from 'vue';
import UxCool from '@cloud-sn/uxcool';
import '@cloud-sn/uxcool/dist/uxcool.css';
Vue.use(UxCool);
// Create Vue application
new Vue({
el: '#app',
template: 'Hello UXCool'
});
```
--------------------------------
### UXCool Button Component Examples
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Illustrates various ways to use the UXCool Button component, including different types, icons, loading states, sizes, as links, button groups, and disabled states.
```vue
PrimaryGhostDashedDangerSearch
Submit
Delayed Loading
SmallDefaultLarge
Link Button
CancelOKDisabled
```
--------------------------------
### Vue Upload Component Examples
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates various configurations of the UXCool Upload component. Includes basic file upload, drag-and-drop functionality, image uploads with previews, and custom request handling. It utilizes Vue.js template syntax and component lifecycle hooks.
```vue
Click to Upload
Click or drag file to this area to upload
Support for a single or bulk upload
Upload
Custom Upload
```
--------------------------------
### Import Vue and v-table Component
Source: https://github.com/suning-cloud-team/uxcool/blob/master/packages/v-table/README.md
Example of importing the Vue library and the v-table component from the '@cloud-sn/v-table' package. This is the initial step for using the component in a Vue application.
```javascript
import Vue from 'vue';
import Pagination from '@cloud-sn/v-table';
```
--------------------------------
### UXCOOOL Input Component Examples (Vue)
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
This snippet showcases various configurations of the UXCOOOL Input Component. It includes basic usage with v-model, inputs with clear buttons and event handlers, inputs with prepended and appended addons, character limit functionality, password input type, search input variations, different size options, and a textarea with auto-resize. It also demonstrates how to group multiple inputs.
```vue
```
--------------------------------
### UXDatePicker Component Examples (Vue)
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates various use cases of the UXDatePicker component in Vue.js, including basic date selection, date with time, date range selection, and pickers for month, week, and year. It also shows how to implement custom logic for disabling dates and times.
```vue
```
--------------------------------
### UXCool Modal Component Implementation (Vue)
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates how to use the UXCool Modal component in Vue.js. It covers basic modal display, confirmation modals, modals with custom footers, and centered modals. It requires the UXCool UI library to be installed and registered.
```vue
Open Modal
Modal content goes here...
You can add any Vue components or HTML.
Confirm
Custom footer example
Cancel
OK
This modal is centered on the screen.
```
--------------------------------
### UX Select Component Examples in Vue.js
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates the usage of the UX Select component for various scenarios including basic selection, search, multiple selections, tags, option groups, data source binding, and virtual scrolling. It requires Vue.js for rendering and includes methods for filtering and handling selection changes.
```vue
```
--------------------------------
### UXCool Message and Notification APIs (JavaScript)
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Provides examples for using the Message and Notification APIs in UXCool for user feedback. The Message API is for simple global feedback, while the Notification API allows for more complex, dismissible alerts. These APIs are typically accessed via `this.$message` and `this.$notification` within a Vue component context.
```javascript
// Message API - Global feedback messages
this.$message.success('Success message');
this.$message.error('Error message');
this.$message.warning('Warning message');
this.$message.info('Info message');
this.$message.loading('Loading...', 0); // 0 = no auto-close
// With duration
this.$message.success('This will close in 3 seconds', 3);
// With callback
this.$message.success('Operation completed', 2, () => {
console.log('Message closed');
});
// Configuration
this.$message.config({
duration: 2, // seconds
top: '100px',
maxCount: 3
});
// Destroy all messages
this.$message.destroy();
// Notification API - More complex notifications with title and description
this.$notification.success({
title: 'Success',
message: 'Your operation completed successfully',
duration: 4.5,
placement: 'topRight' // topLeft, topRight, bottomLeft, bottomRight
});
this.$notification.error({
title: 'Error',
message: 'Something went wrong',
description: 'Please try again later',
duration: 0, // Won't auto-close
onClose: () => {
console.log('Notification closed');
}
});
this.$notification.warning({
title: 'Warning',
message: 'Please be careful',
placement: 'bottomRight'
});
this.$notification.info({
title: 'Information',
message: 'Here is some useful information'
});
// Open with custom key for updating
this.$notification.open({
key: 'updatable',
title: 'Processing',
message: 'Your request is being processed...'
});
// Update existing notification
setTimeout(() => {
this.$notification.success({
key: 'updatable',
title: 'Complete',
message: 'Your request has been processed'
});
}, 2000);
// Close specific notification
this.$notification.close('updatable');
// Destroy all notifications
this.$notification.destroy();
```
--------------------------------
### On-Demand Component Import with UXCool
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Shows how to import specific UXCool components and their styles on demand. This approach is beneficial for reducing bundle size by only including necessary components.
```javascript
// Import specific components with styles
import '@cloud-sn/uxcool/es/button/style/css';
import '@cloud-sn/uxcool/es/input/style/css';
import '@cloud-sn/uxcool/es/select/style/css';
import { UxButton } from '@cloud-sn/uxcool/es/button';
import { UxInput } from '@cloud-sn/uxcool/es/input';
import { UxSelect, UxOption, UxOptionGroup } from '@cloud-sn/uxcool/es/select';
export default {
components: {
UxButton,
UxInput,
UxSelect,
UxOption,
UxOptionGroup
},
data() {
return {
inputValue: '',
selectValue: ''
};
}
};
```
--------------------------------
### UXCool Basic Tree Component Implementation
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Demonstrates the basic usage of the ux-tree component. It displays hierarchical data and handles node selection events. Requires a data-source prop for tree data and an optional default-expanded-keys prop.
```vue
```
--------------------------------
### Automatic On-Demand Import with Babel Plugin for UXCool
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Explains how to configure the Babel import plugin to automatically handle on-demand imports for UXCool components and their styles. This simplifies the import process in your code.
```javascript
// .babelrc configuration
{
"plugins": [
["import", {
"libraryName": "@cloud-sn/uxcool",
"style": "css"
}]
]
}
// Then import directly without manual style imports
import { UxButton, UxInput, UxSelect } from '@cloud-sn/uxcool';
// Styles are automatically imported
```
--------------------------------
### UXCool Checkable Tree Component Implementation
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Implements a checkable version of the ux-tree component, allowing users to select nodes with checkboxes. It manages checked and expanded keys and provides callbacks for check and expand events. Requires `checkable` prop and `checked-keys`, `expanded-keys` for state management.
```vue
```
--------------------------------
### UXCool Async Loading Tree Component
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Configures the ux-tree component for asynchronous data loading. The `load-data` prop accepts a function that returns a Promise resolving with child nodes, enabling dynamic loading of data as users expand nodes. Requires `load-data` prop.
```vue
```
--------------------------------
### Configure NPM Registry and Add v-pagination Dependency
Source: https://github.com/suning-cloud-team/uxcool/blob/master/packages/v-table/README.md
Commands to configure the npm registry for the cloud-sn scope and to add the v-pagination component as a project dependency. This is necessary for the v-table component's pagination functionality.
```bash
npm config set @cloud-sn:registry http://snpm.cnsuning.com
yarn add @cloud-sn/v-pagination
```
--------------------------------
### UXCool Tree with Custom Node Rendering
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
Shows how to customize the rendering of tree nodes using scoped slots. The `show-icon` and `show-line` props can be enabled, and a `#title` slot allows for custom content within each node's title. Accepts `show-icon`, `show-line` props.
```vue
{{ title }} ({{ key }})
```
--------------------------------
### Vue Form with Validation and Submission
Source: https://context7.com/suning-cloud-team/uxcool/llms.txt
A Vue.js component demonstrating a form with various input fields (username, email, password, age, gender) and a checkbox for terms. It utilizes the UXcool form components and their validation rules to ensure data integrity before submission. The `handleSubmit` method includes form validation, submission simulation, and error handling, while `handleReset` clears the form fields.
```vue
I agree to the terms and conditions
Submit
Reset
```