### Vue Steps Component Example
Source: https://tmui.design/com/steps-item.html
Demonstrates the usage of the tm-steps and tm-steps-item components in Vue. It showcases various configurations like hiding labels, custom states, and interactive steps with custom layouts and descriptions. This example requires the TMUI library to be installed and configured.
```vue
步骤条 tmSteps
子组件独立,方便灵活自定义。
隐藏标签
完全自定义状态
{{item}}
显示标签
自定状态及进度。并允许点击交互改变进度。
注册帐号
审核
发放牌证
结算
显示标签
自定状态及进度。并允许点击交互改变进度。
注册帐号
自定义布局外观
发放牌证
结算
```
--------------------------------
### Vue Signature Pad Example (TmSignBoard)
Source: https://tmui.design/com/sign-board.html
This Vue script demonstrates the usage of the TmSignBoard component. It shows how to import the component, get a reference to its instance, and use methods like getImage and clear. The template includes the TmSignBoard within tm-sheet components and buttons to trigger the clear and getImage actions.
```vue
签名版 TmSignBoard
清空
获取图片
```
--------------------------------
### TmTag Component Usage Example (Vue)
Source: https://tmui.design/com/tag.html
Demonstrates how to use the TmTag component in a Vue template, showcasing different sizes, skins, states, icon integrations, and custom styling options like rounded corners and gradients. This example requires the TMUI framework to be installed and configured.
```vue
标签 TmTag
样式丰富塑造性好。
大小
极小
小
中等
默认
大标签
状态及样式
禁用
outlined
thin
dashed
normal
text
图标
图标
回复
为您点赞
这是一个非常长的小标签
为您点赞
为您点赞
其它自定样式
加载中
圆角半径
渐变
浅色
渐变
渐变
渐变
```
--------------------------------
### Vue Date Picker Example
Source: https://tmui.design/com/picker-date.html
This Vue template demonstrates the usage of the TmPickerDate component for selecting dates. It shows how to set start and end dates, format the output, and handle user interactions like assigning a date and using an embedded date view (TmDateView).
```vue
日期选择器 PickerDate
日期选择,可以控制显示精确到秒。默认的开始时间为当前时间的上一年,结束时间为默认当前时间
打开时间
选中的值:{{ modelValue }}
经format的值:{{ nowVal }}
赋值2024-3-21
内嵌日期选择器 xDateView
选中的值:{{ nowVal2 }}
精确到秒
打开时间
```
--------------------------------
### Vue Drawer Examples: Basic Usage and Positioning
Source: https://tmui.design/com/drawer.html
Demonstrates the basic usage of the tm-drawer component in Vue, showcasing different positioning options (left, right, top, bottom). It highlights how to use the 'trigger' slot for custom button-based opening and basic content display within the drawer.
```vue
抽屉 Drawer
提供四个方向的弹出,如果要居中显示,请使用overlay组件。可以设置高为auto,百分比,最大值
可以是插槽触发或者变量控制触发
左弹出
左弹出
右弹出
此弹层有内容开启了事件协商和手势关闭,向上滑一定的距离能关闭弹层。
顶弹出
底弹出
嵌套
打开嵌套
打开嵌套1
当前弹层内容为自动高度
打开嵌套2
当前弹层内容为自动高度
确认前异步执行beforeClose
打开
点确认 按钮,会等待3秒再关闭。
默认高度,禁用遮罩关闭
点击遮罩禁用关闭,同时内容出现弹跳提示
禁用遮罩,弹跳提醒
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
底部插槽及变量控制显示
打开
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
精致美观的对话框,可全局配置风格
```
--------------------------------
### Basic Flexbox Layout Example
Source: https://tmui.design/CSSTool/css.html
An example of using TMUI's flexbox utility classes to create a simple row-based layout. The `flex`, `flex-row` classes enable flex container behavior with horizontal arrangement. This is a fundamental building block for responsive layouts.
```vue
```
--------------------------------
### TmEchart Vue Component Example
Source: https://tmui.design/com/echart.html
Demonstrates the usage of the TmEchart component in a Vue template. It shows how to initialize a chart with data using the `onInit` event and how to manually set chart options using a ref and the `getChart` method. The example also includes handling click events on chart elements.
```vue
百度图表 TmEchart
可以通过onInit或者getChart获取Chart对象来设置更新数据图表。点击数据可以响应事件。
可以通过ref来初始数据
手动赋值
```
--------------------------------
### TMUI Drawer Component
Source: https://tmui.design/com/drawer.html
API documentation for the tm-drawer component, including configuration parameters, events, and slots.
```APIDOC
## Component: tm-drawer
### Description
A highly customizable drawer component that supports global style configuration, various positioning, and interactive slots.
### Parameters
- **customStyle** (string) - Optional - Custom overlay style
- **title** (string) - Optional - Drawer title
- **showFooter** (boolean) - Optional - Show bottom action bar
- **showTitle** (boolean) - Optional - Show title bar
- **showClose** (boolean) - Optional - Show close button
- **overlayClick** (boolean) - Optional - Allow closing by clicking the overlay
- **show** (boolean) - Required - Controls visibility (supports v-model)
- **position** (string) - Optional - Drawer opening direction (default: "bottom")
- **size** (string|number) - Optional - Content width/height percentage or auto
- **zIndex** (string|number) - Optional - Layer index (default: 1100)
- **lazy** (boolean) - Optional - Lazy load content to improve animation performance
### Events
- **click** - Triggered when clicking the overlay
- **close** - Triggered when the drawer closes
- **open** - Triggered when the drawer opens
- **cancel** - Triggered when the cancel button is clicked
- **confirm** - Triggered when the confirm button is clicked
### Slots
- **trigger** - Custom trigger element
- **title** - Custom title area
- **default** - Main content area
- **footer** - Bottom action bar area
### Ref Methods
- **beforeClose** - Async function to intercept closing logic; return false to prevent closing.
```
--------------------------------
### TmSwitch Component Example (Vue)
Source: https://tmui.design/com/switch.html
Demonstrates the usage of the TmSwitch component in a Vue template. It showcases various configurations including size, labels, colors, disabled and loading states, and rounded corners. The example utilizes tm-sheet and tm-text components for layout and display.
```vue
开关 tmSwitch
样式可全局配置,统一修改风格
显示内文字
修改颜色
状态
圆角风格,及修改间隙
```
--------------------------------
### TmTabs Navigation Component Example (Vue)
Source: https://tmui.design/com/tabs.html
Demonstrates the usage of the TmTabs component in Vue.js, showcasing various configurations for displaying navigation tabs with different styling, data, and interactive elements. It includes examples for basic tabs, equal distribution, custom colors, and custom styles.
```vue
标签导航 tmTabs
tabs标签导航组件,样式非常丰富可以完成你想要的自定义样式.
均分
均分线等宽修改激活色
自定背景相关
使用自定style完全覆盖样式
```
--------------------------------
### Grid Layout Example
Source: https://tmui.design/CSSTool/css.html
Shows how to implement a grid layout using TMUI's `grid` and `grid-col-[x]` classes. This allows elements to be arranged in a specified number of columns per row, with automatic wrapping to the next line.
```vue
class="grid grid-col-5"
```
--------------------------------
### Vue Date Picker Example with TmPickerDate
Source: https://tmui.design/com/date-view.html
This Vue template demonstrates the usage of the TmPickerDate component for selecting dates. It allows customization of start and end dates, date formatting, and provides examples for setting values and displaying selected dates. It also shows how to use the component for second-level precision.
```vue
日期选择器 PickerDate
日期选择,可以控制显示精确到秒。默认的开始时间为当前时间的上一年,结束时间为默认当前时间
打开时间
选中的值:{{ modelValue }}
经format的值:{{ nowVal }}
赋值2024-3-21
内嵌日期选择器 xDateView
选中的值:{{ nowVal2 }}
精确到秒
打开时间
```
--------------------------------
### Basic tm-drawer Usage with Footer
Source: https://tmui.design/com/drawer.html
Demonstrates the basic implementation of the tm-drawer component, including how to define a custom footer slot with a button. This snippet shows the core structure for using the drawer.
```vue
定义底部插槽
```
--------------------------------
### Register TMUI in Vue main.ts
Source: https://tmui.design/32vue/%E5%AE%89%E8%A3%85.html
Configures the Vue application instance by installing Pinia, the router, and the TMUI component library. This is the entry point for initializing the UI framework within a Vue project.
```typescript
import { createApp } from 'vue'
// @ts-ignore
import './style.css'
import App from './App.vue'
//必须安装
import { createPinia } from 'pinia'
//必须安装
import router from './router'
// 引入组件包
import tmui from './components/tm-ui'
const app = createApp(App)
app.use(createPinia())
app.use(router)
// 最后引用安装好。
app.use(tmui)
app.mount('#app')
```
--------------------------------
### Implement pull-to-refresh and bottom-loading with tmPullRefresh
Source: https://tmui.design/com/pull-refresh.html
This example demonstrates how to use the tmPullRefresh component within a Vue 3 setup script. It defines asynchronous functions for both pull-down and bottom-loading events, returning a promise to signal completion.
```vue
下拉刷新
请拖拉下拉刷新
触底刷新
上拖触底刷新
```
--------------------------------
### Implement tmPopover with various positions and content
Source: https://tmui.design/com/popover.html
This example demonstrates how to use the tmPopover component with different positioning attributes (e.g., 'bl', 'bc', 'tl'). It shows how to inject custom content like tm-cell lists or tm-calendar-multiple components into the popover menu slot.
```vue
汽泡菜单 tmPopover
多达8个位置可选,当显示位置不足时可以自动反转位置。
```