|
| 1 | +# TinyVue carousel 组件生成 schema |
| 2 | + |
| 3 | +TinyCarousel是一个走马灯组件。 |
| 4 | +componentName 为渲染时候的组件名称,props 为组件绑定的属性,children 为子组件列表,id 为可以动态生成的唯一 id。 |
| 5 | +componentName 为 TinyCarouselItem 的组件, 通过对应的 title 属性,可以设置标题。 通过对应的 name 属性,可以设置唯一标识, 通过对应的 indicator-position 属性,可以设置指示器位置。可选值为 outside 和 none。 |
| 6 | + |
| 7 | +## carousel 组件生成 schema 代码示例 |
| 8 | + |
| 9 | +### 基本用法 |
| 10 | + |
| 11 | +```json |
| 12 | +{ |
| 13 | + "componentName": "TinyCarousel", |
| 14 | + "props": { |
| 15 | + "height": "180px", // 设置走马灯的高度。 |
| 16 | + "className": "component-base-style", |
| 17 | + "arrow": "always", // 可以设置切换箭头的显示效果。默认值为 hover, 可选值为 always 、 hover 和 never。 |
| 18 | + "autoplay": true, // 可以设置是否自动切换。 |
| 19 | + "indicator-position": "outside", // 可以设置指示器位置。可选值为 outside 和 none。 |
| 20 | + "initial-index": 0, // 可以设置初始状态激活的幻灯片的索引。 |
| 21 | + "interval": 5000, // 可以设置自动切换的时间间隔,单位为毫秒。 |
| 22 | + "loop": true, // 可以设置是否循环显示。 |
| 23 | + "show-title": true, // 可以设置是否显示标题。 |
| 24 | + "trigger": "hover", // 可以设置指示器的触发方式。默认值为 hover,可选值为 hover 和 click。 |
| 25 | + "type": "card", // 可以设置走马灯的类型。默认值为 horizontal,可选值为 horizontal 、 vertical 和 card。 |
| 26 | + "ref": "carousel", // 可以设置需要的ref引用类名。 |
| 27 | + // 走马灯的事件,包括 onChange(值被改变时触发)、onFocus(获得焦点时触发)、onClick(点击事件)、onMousemove(鼠标移动时触发),添加对应的事件类型为当前属性,value值绑定事件名,取对应的参数值 |
| 28 | + "onClick": { |
| 29 | + "type": "JSExpression", |
| 30 | + "value": "this.onClickNew" |
| 31 | + } |
| 32 | + }, |
| 33 | + "children": [ |
| 34 | + { |
| 35 | + "componentName": "TinyCarouselItem", |
| 36 | + "props": { |
| 37 | + "title": "carousel-item-a" |
| 38 | + }, |
| 39 | + "children": [ |
| 40 | + { |
| 41 | + "componentName": "div", |
| 42 | + "props": { |
| 43 | + "style": "margin:10px 0 0 30px" |
| 44 | + }, |
| 45 | + "id": "614d4146" |
| 46 | + } |
| 47 | + ], |
| 48 | + "id": "2366c336" |
| 49 | + }, |
| 50 | + { |
| 51 | + "componentName": "TinyCarouselItem", |
| 52 | + "props": { |
| 53 | + "title": "carousel-item-b" |
| 54 | + }, |
| 55 | + "children": [ |
| 56 | + { |
| 57 | + "componentName": "div", |
| 58 | + "props": { |
| 59 | + "style": "margin:10px 0 0 30px" |
| 60 | + }, |
| 61 | + "id": "1732256d" |
| 62 | + } |
| 63 | + ], |
| 64 | + "id": "442457ef" |
| 65 | + } |
| 66 | + ], |
| 67 | + "id": "231c8a63" |
| 68 | +} |
| 69 | +``` |
0 commit comments