### Example Script Setup for xWeekbar (Vue) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/weekbar.md The ``` -------------------------------- ### Script for UNIAPP Badge Example Page Source: https://github.com/tmzdy888/tmui4-doc/blob/main/badge.md Provides the minimal JavaScript script block required for the UNIAPP example page component. It defines the component's reactive data properties and includes the standard `onLoad` lifecycle hook, although no badge-specific logic is implemented in this basic example. ```JavaScript ``` -------------------------------- ### Example x-mention Logic Script (UTS) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/mention.md Provides the UTS script logic (`script setup`) for the example template. It uses Vue 3 Composition API features (`ref`, `computed`) to manage UI state (drawer visibility, input value, mention list, chat messages) and component references. It defines event handlers (`onmention`, `cellClick`, `beforeRemove`, `removemention`, `onconfirm`) to interact with the `x-mention` component and simulate a mention selection workflow. ```UTS import { ref } from "vue" type PENGYOU_TYPE = { name : string, id : string } const show = ref(false) const keyword = ref("") const mention = ref(null) const pengyouList = ref([]) const pengyouListNames = computed(():string[] => pengyouList.value.map((el:PENGYOU_TYPE):string=> ('@'+el.name))) const chat = ref([]) const tags = ref([]) // 添加虚拟数据 for (let i = 0; i < 10; i++) { pengyouList.value.push({ name: "朋友" + i, id: i.toString() } as PENGYOU_TYPE) } const onmention = () => { show.value = true; } const cellClick = (str : string) => { if(mention.value==null) return; keyword.value += str + ' ' show.value = false; mention.value!.setFoucus(true) tags.value.push(str) } //删除前需要校验当前删除的标签是不是朋友标签,因为如果用户把光标移动有名称内删除,打乱了标签,其实已经不构成是标签了,就不需要删除了. const beforeRemove = (tag : string) : boolean => { let index = pengyouList.value.findIndex((el : PENGYOU_TYPE) : boolean => el.name == tag) console.log("即将删除标签:", tag, index > 1 ? '是' : '否') return index > -1 } const removemention = (tag : string) => { console.log("被删除标签:", tag) } const onconfirm = (nowval:string)=>{ chat.value.push(nowval) keyword.value = '' } ``` -------------------------------- ### Example Page Script (JavaScript) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/action-modal.md This JavaScript snippet provides the script logic for the example page. It defines a 'showModal' data property to control the visibility state of the x-action-modal and sets it to 'true' in the 'onReady' lifecycle hook, causing the modal to display when the page is ready. ```JavaScript ``` -------------------------------- ### Example Implementation Template HTML Source: https://github.com/tmzdy888/tmui4-doc/blob/main/dropdown-menu.md Full template code for an example page demonstrating various uses of x-dropdown-menu. It includes using v-model for control, nesting x-dropdown-item components with custom content, handling different positioning modes (fixed and static), and conditional rendering directives for platform compatibility. ```HTML ``` -------------------------------- ### Script Logic for x-indexbar Example Page JS/UTS Source: https://github.com/tmzdy888/tmui4-doc/blob/main/indexbar.md Contains the script logic for the example page using the x-indexbar component. It imports sample data and a store, initializes component data, and defines a computed property to check the current theme mode using the xStore. ```JavaScript ``` -------------------------------- ### Styling tmui4 TextCloud Example Page (SCSS) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/text-cloud.md Provides an empty style block for the example page using SCSS. It currently contains no specific styles but serves as a placeholder for adding component or page-level styling. ```SCSS ``` -------------------------------- ### Example Usage of x-icon Component - HTML Source: https://github.com/tmzdy888/tmui4-doc/blob/main/icon.md Comprehensive example demonstrating the `x-icon` component's features in a Uni-app template, including setting icons by `name`, rotating icons with the `rotation` prop, changing color with the `color` prop, and applying a spin animation with the `spin` prop. Includes conditional rendering for different platforms. ```html ``` -------------------------------- ### Example Page Styles (SCSS) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/action-modal.md This is the style block for the example page using SCSS. The block is currently empty, indicating that no specific styles are defined or applied within this section for the page or its components. ```SCSS ``` -------------------------------- ### Example Logic Script JavaScript Source: https://github.com/tmzdy888/tmui4-doc/blob/main/dropdown-menu.md JavaScript code providing the data and methods for the example page template. It manages the active state of the dropdown menu using the `activeIndex` data property and defines an `onchange` method to handle the dropdown's change event, logging the selected index, key name, and status. ```JavaScript ``` -------------------------------- ### Example Styles for xCountdown Page (SCSS) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/countdown.md The style section for the example UNIAPP page using the `x-countdown` component. It specifies the language as SCSS but contains no actual styles, indicating that styling relies on default component styles, inline styles, or styles defined elsewhere. ```SCSS ``` -------------------------------- ### Component Script Structure - UTS Source: https://github.com/tmzdy888/tmui4-doc/blob/main/icon.md The script section for the Uni-app page example, defining the component's data and methods placeholders. Written in UTS, it provides the basic structure but doesn't contain specific logic directly related to the `x-icon` component's props or events in this minimal example. ```uts ``` -------------------------------- ### Example Page Script with TMUI4 Javascript Source: https://github.com/tmzdy888/tmui4-doc/blob/main/rate.md This is the basic script block for the example page using the x-rate component. It exports a default Vue component object with an empty data function, serving as a minimal setup for the page. ```javascript ``` -------------------------------- ### Example Usage of x-sign-board Component - Template Source: https://github.com/tmzdy888/tmui4-doc/blob/main/sign-board.md This snippet shows how to integrate the x-sign-board component into a Vue template. It includes examples of setting its height and binding its ref, as well as demonstrating interaction buttons (Save, Check, Clear) and usage within a modal. It also shows how to display the saved image. ```template ``` -------------------------------- ### Rendering tmui4 TextCloud Example Page (Vue Template) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/text-cloud.md Provides a complete template structure for an example page demonstrating the `x-text-cloud` component. It includes conditional rendering for `APP` and `MP-WEIXIN` platforms, basic layout components (`x-sheet`, `x-text`), and two instances of `x-text-cloud` using different data lists (`list` and `list2`). ```HTML ``` -------------------------------- ### Example Style Block SCSS Source: https://github.com/tmzdy888/tmui4-doc/blob/main/msg-notice.md An empty style block placeholder for component-specific styles, configured to use SCSS. In this particular example, no custom styles are defined within the block. ```SCSS ``` -------------------------------- ### Example x-mention Usage Template (UTS/UNIAPP) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/mention.md Provides a full UNIAPP template example demonstrating the use of the `x-mention` component. It includes conditional compilation for different platforms, basic layout components (`x-sheet`, `x-text`), iteration (`v-for`), data binding (`v-model`), event handling (`@confirm`, `@mention`, `@beforeRemove`, `@removemention`), referencing the component (`ref`), and integrating with a selection drawer (`x-drawer`) for mentioning users. ```html ``` -------------------------------- ### Example Markdown Input String Source: https://github.com/tmzdy888/tmui4-doc/blob/main/markdown.md This string represents the markdown content assigned to the `str` data property, including headers, bold text, tables, and fenced code blocks (CSS, Javascript) to be rendered by the x-markdown component. ```Markdown # 全局配置 ## 介绍 本配置参数会影响整个app风格,请慎重配置,或者根据你的UI/UX设计师指示配置 **可以在任意位置导入并设置,立即生效,全局响应**\n**堙** | This header | spans two | Header A | |-------------|------------|----------| | Cell A | Cell B | Cell C | | Cell A | Cell B | Cell C | | Cell A | Cell B | Cell C | ## CSS代码 \`\`\`css <--!>输入内容 <\/uni-view> \`\`\` \`\`\`css const highlight = "code"; \`\`\` ``` -------------------------------- ### Basic xTree Component Usage - HTML Source: https://github.com/tmzdy888/tmui4-doc/blob/main/tree.md Demonstrates the simplest way to use the x-tree component by including its tag in a template. This basic example shows the component inclusion without any specific props or event bindings. ```HTML ``` -------------------------------- ### Page Styling SCSS Source: https://github.com/tmzdy888/tmui4-doc/blob/main/watermark.md Provides a block for defining page-specific styles using SCSS syntax. This particular snippet is empty, indicating that no custom styles are applied in this example. Requires an SCSS compiler or preprocessor setup. ```SCSS ``` -------------------------------- ### Example Style Block for xWeekbar (Vue) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/weekbar.md The ``` -------------------------------- ### Using xBetweenTime Component with Data Binding - Vue/uni-app Source: https://github.com/tmzdy888/tmui4-doc/blob/main/between-time.md This code snippet demonstrates how to integrate and use the xBetweenTime component within a Vue/uni-app template. It shows binding the selected date range using `v-model` to the `newdata` variable and the formatted output string using `v-model:model-str` to the `nowVal` variable. It also sets explicit start and end dates and includes examples of using quick date buttons. ```Vue/uni-app ``` -------------------------------- ### Example Page Styling for x-float-drawer CSS Source: https://github.com/tmzdy888/tmui4-doc/blob/main/float-drawer.md This CSS snippet provides scoped styles for the example page components. It defines the '.heightani' class used in the template, setting up a CSS transition specifically for the 'height' property with a linear timing function to support the dynamic height adjustments driven by the JavaScript logic. ```CSS ``` -------------------------------- ### Example Page Script for x-float-drawer JavaScript Source: https://github.com/tmzdy888/tmui4-doc/blob/main/float-drawer.md This script provides the logic for the example page using the x-float-drawer. It manages the drawer's visibility via the 'showFloat' data property and includes methods ('onbeforeclose', 'onmovestart', 'onmoveend', 'onheightChange') to handle events emitted by the drawer, specifically manipulating a DOM element's style based on the 'heightChange' event to create a dynamic animation. ```JavaScript ``` -------------------------------- ### Example Usage Script for x-switch-slider (UTS Script) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/switch-slider.md Provides the script logic for the example page using x-switch-slider in UNIAPP/UTS. It initializes sample data for a list of items, demonstrates populating the list in the beforeMount hook, and includes methods to handle slider open/close events (managing state for multiple sliders), menu item clicks (share, remove), main item clicks, and a special event to manage external scroll disabling. Uses UTSJSONObject for data structure. ```UNIAPP/Vue/UTS Script ``` -------------------------------- ### Example Usage Template for xCountdown (UNIAPP Vue) Source: https://github.com/tmzdy888/tmui4-doc/blob/main/countdown.md Provides a complete UNIAPP template example showcasing the integration of `x-countdown` components. It includes conditional compilation directives, layout components (`x-sheet`, `x-text`, `x-button`), and two instances of `x-countdown` configured with different times, units, and formats. It also demonstrates controlling the countdown state (play, pause, reset) using buttons bound to data properties via `v-model:actions`. ```HTML ``` -------------------------------- ### Example Vue Script with x-markdown Interaction Source: https://github.com/tmzdy888/tmui4-doc/blob/main/markdown.md This script demonstrates the data properties, lifecycle hooks, and methods used with the x-markdown component, including initializing markdown content, handling tag click events, simulating stream-like content updates, and appending text. ```Javascript ``` -------------------------------- ### Example Vue Template Structure with x-markdown Source: https://github.com/tmzdy888/tmui4-doc/blob/main/markdown.md This template demonstrates integrating the x-markdown component within a UniApp page structure, using other tmx-ui components like x-sheet, x-text, and x-button, and handling conditional compilation for different platforms. ```Vue ``` -------------------------------- ### Calling the Reset Method via Ref in UTS Source: https://github.com/tmzdy888/tmui4-doc/blob/main/slide-verify.md Provides an example in UTS (UTS is used for APP-specific script setup) demonstrating how to use a component ref (`ref='verify'`) to access the xSlideVerify instance and programmatically call its `reset` method, often triggered by user interaction like a button click. ```UTS const verify = ref(null) const reset = () => { if(verify.value==null) return; verify.value?.reset?.() } ```