### Extend BaseService for CRUD Operations (TypeScript) Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt Demonstrates extending the BaseService class to implement custom CRUD operations and custom methods for a UserService. It shows how to define the API namespace and override default methods. Usage examples in a component are also provided. ```typescript // src/service/user.ts import { BaseService } from '/@/cool'; class UserService extends BaseService { constructor() { super('admin/user'); // API namespace: /admin/user/xxx } // Custom method async changePassword(data: { oldPassword: string; newPassword: string }) { return this.request({ url: '/changePassword', method: 'POST', data }); } // Override default methods if needed async page(data: any) { return this.request({ url: '/page', method: 'POST', data: { ...data, includeRoles: true } }); } } export default new UserService(); // Usage in component: import userService from '/@/service/user'; // Standard CRUD operations await userService.page({ page: 1, size: 20 }); await userService.list({ status: 1 }); await userService.info({ id: 1 }); await userService.add({ name: 'John', email: 'john@example.com' }); await userService.update({ id: 1, name: 'John Doe' }); await userService.delete({ ids: [1, 2, 3] }); // Custom method await userService.changePassword({ oldPassword: '123456', newPassword: 'newpass123' }); ``` -------------------------------- ### Install and Configure Cool-Admin Vue CRUD Plugin Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt This snippet demonstrates how to install and globally register the `@cool-vue/crud` plugin in a Vue 3 application. It includes essential global configuration options for API endpoints, primary IDs, pagination, and styling for form and table components. ```typescript import { createApp } from 'vue'; import App from './App.vue'; import ElementPlus from 'element-plus'; import { Crud } from '@cool-vue/crud'; const app = createApp(App); app.use(ElementPlus); app.use(Crud, { // Global configuration options dict: { primaryId: 'id', api: { list: 'list', add: 'add', update: 'update', delete: 'delete', info: 'info', page: 'page' }, pagination: { page: 'page', size: 'size' } }, style: { form: { labelWidth: '100px', span: 24 }, table: { border: true, autoHeight: true } } }); app.mount('#app'); ``` -------------------------------- ### Enable Test Service Mode for Mock Data (Vue) Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt Illustrates how to configure and use the Cool Admin Vue CRUD component with the 'test' service mode. This mode provides mock data for development and prototyping, eliminating the need for a backend. It includes setup for the crud, table, and upsert components. ```vue ``` -------------------------------- ### Configure CRUD Component Language Labels with TypeScript Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt This snippet demonstrates how to configure language labels for CRUD components in Cool-Admin Vue using TypeScript. It involves importing the `Crud` plugin and providing a dictionary of labels for various operations and messages. This setup allows for easy internationalization of the admin panel. ```typescript // main.ts import { Crud } from '@cool-vue/crud'; app.use(Crud, { dict: { label: { op: 'Operation', add: 'Add', delete: 'Delete', multiDelete: 'Delete', update: 'Edit', refresh: 'Refresh', info: 'Details', search: 'Search', reset: 'Reset', clear: 'Clear', save: 'Save', close: 'Cancel', confirm: 'Confirm', advSearch: 'Advanced Search', searchKey: 'Search Keyword', placeholder: 'Please enter', tips: 'Tips', saveSuccess: 'Save successful', deleteSuccess: 'Delete successful', deleteConfirm: 'This operation will permanently delete the selected data. Do you want to continue?', empty: 'No data available', desc: 'Descending', asc: 'Ascending', select: 'Select', deselect: 'Deselect', seeMore: 'See more', hideContent: 'Hide content', nonEmpty: '{label} cannot be empty', collapse: 'Collapse', expand: 'Expand' } } }); ``` -------------------------------- ### Implement cl-dialog Component (Vue) Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt Shows how to use the cl-dialog component in a Vue application. It covers basic usage, setting dialog properties like title, width, height, and controls. It also demonstrates handling the before-close event and listening for fullscreen changes. ```vue ``` -------------------------------- ### Configure Table with useTable Hook in Vue.js Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt This snippet demonstrates how to configure a table using the `useTable` hook in Vue.js. It covers setting up columns, enabling features like auto-height, context menus, default sorting, and various column types including selection, index, expand, text, image, dictionary mapping, switch for inline editing, custom formatting, and operation buttons. It also shows how to integrate with `cl-crud` and `cl-row` components. ```vue ``` -------------------------------- ### Create and Manage Form Dialogs with useForm Hook (Vue.js) Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt Demonstrates how to use the `useForm` hook to open a form dialog, configure its title, width, pre-fill data, define form items including tabs and conditional fields, and handle form events like opening, closing, and submission. This hook is essential for building interactive forms within the Cool Admin Vue framework. ```vue ``` -------------------------------- ### Implement Advanced Search Panel with useAdvSearch Hook in Vue Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt The `useAdvSearch` hook provides a slide-out advanced search panel for complex filtering scenarios in Cool Admin Vue. It allows for a more extensive set of form fields to be presented to the user for detailed data filtering. This hook integrates with the CRUD components for a cohesive user experience. ```vue ``` -------------------------------- ### Implement Search Panel with useSearch Hook in Vue Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt The `useSearch` hook in Cool Admin Vue allows for the creation of a search panel within a CRUD interface. It supports various form components, custom layouts, and event handlers for search actions. This hook is useful for filtering table data based on user input. ```vue ``` -------------------------------- ### Implement Data Management with useCrud Hook in Vue Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt This Vue component utilizes the `useCrud` hook to manage data operations and UI components like tables, forms, and search panels. It shows how to bind to a backend service, define custom hooks for refresh and delete operations, and programmatically control CRUD actions. ```vue ``` -------------------------------- ### Vue useUpsert Hook for CRUD Operations Source: https://context7.com/cool-team-official/cool-admin-vue/llms.txt Demonstrates the implementation of the useUpsert hook in a Vue.js component for handling add, edit, and info operations. It configures table columns, form items with dynamic visibility, dialog settings, and various lifecycle hooks for data persistence and user interaction. ```vue ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.