|
1 | 1 | <template> |
2 | | - <div> |
3 | | - <div class="site-content-title">提示框</div> |
4 | | - <div class="site-content-des">提示框的作用是在页面级别的交互反馈中用以给用户展示场景信息,大部分情况下,提示框都应该是固定在某个具体位置不主动消失。</div> |
5 | | - <div class="cd-row"> |
6 | | - <div class="cd-xs-12"> |
7 | | - <x-panel :code="code.alert_color|trim"> |
8 | | - <div slot="title"> |
9 | | - 场景提示框 |
10 | | - </div> |
11 | | - <div slot="code"> |
12 | | - <pre v-highlightjs><code class="html"> |
13 | | - {{ code.alert_color }} |
14 | | - </code></pre> |
15 | | - </div> |
16 | | - <div class="cd-mb16" slot="style" v-html="code.alert_color"></div> |
17 | | - <div class="" slot="dec"> |
18 | | - 我们将场景色引入了提示框中,为的是让用户通过场景色能够快速感知提示框可能带来的内容定义。通过成功提示框、错误提示框、警告提示框、信息提示框来区分不同场景下的信息提示。 |
19 | | - </div> |
20 | | - </x-panel> |
21 | | - </div> |
22 | | - <div class="cd-xs-12"> |
23 | | - <x-panel :code="code.alert_close|trim"> |
24 | | - <div slot="title"> |
25 | | - 可关闭提示框 |
26 | | - </div> |
27 | | - <div slot="code"> |
28 | | - <pre v-highlightjs><code class="html"> |
29 | | - {{ code.alert_close }} |
30 | | - </code></pre> |
31 | | - </div> |
32 | | - <div class="cd-mb16" slot="style" v-html="code.alert_close"> |
33 | | - </div> |
34 | | - <div class="" slot="dec"> |
35 | | - 在一些偏向营销的提示框场景下,我们应该给用户以关闭“碍眼的提示信息”的权利。 |
36 | | - </div> |
37 | | - </x-panel> |
38 | | - </div> |
39 | | - </div> |
40 | | - <x-api-table |
41 | | - :code="code.alert_api" |
42 | | - :attrData="attrData" |
43 | | - :hookData="hookData"> |
44 | | - </x-api-table> |
45 | | - </div> |
| 2 | + <x-component-template |
| 3 | + title="提示框" |
| 4 | + des="提示框的作用是在页面级别的交互反馈中用以给用户展示场景信息,大部分情况下,提示框都应该是固定在某个具体位置不主动消失。" |
| 5 | + :card="card" |
| 6 | + :api="api" |
| 7 | + > |
| 8 | + </x-component-template> |
46 | 9 | </template> |
47 | 10 |
|
48 | | -<script> |
| 11 | +<script lang="ts"> |
| 12 | +import Vue from 'vue'; |
| 13 | +import { Component } from 'vue-property-decorator'; |
| 14 | +import XComponentTemplate from '@/components/component-template.vue'; |
| 15 | +
|
49 | 16 | import * as code from './alert'; |
50 | | -import XPanel from '@/components/panel.vue'; |
51 | | -import XApiTable from '@/components/api-table.vue'; |
52 | 17 |
|
53 | | -const attrData = [ |
| 18 | +const card = [ |
54 | 19 | { |
55 | | - name: 'el', |
56 | | - dec: '要绑定的Dom元素', |
57 | | - type: 'String', |
58 | | - value: '无', |
59 | | - optional: '--' |
| 20 | + col: '12', |
| 21 | + title: '场景提示框', |
| 22 | + dec: '我们将场景色引入了提示框中,为的是让用户通过场景色能够快速感知提示框可能带来的内容定义。通过成功提示框、错误提示框、警告提示框、信息提示框来区分不同场景下的信息提示。', |
| 23 | + code: code.alert_color, |
60 | 24 | }, |
61 | | -]; |
62 | | -
|
63 | | -const hookData = [ |
64 | 25 | { |
65 | | - name: 'close', |
66 | | - dec: '关闭后触发的钩子', |
67 | | - callback: '--', |
68 | | - args: 'args1: $alert,被绑定的Dom元素的jquery对象' |
| 26 | + col: '12', |
| 27 | + title: '可关闭提示框', |
| 28 | + dec: '在一些偏向营销的提示框场景下,我们应该给用户以关闭“碍眼的提示信息”的权利。', |
| 29 | + code: code.alert_close |
69 | 30 | } |
70 | 31 | ]; |
71 | 32 |
|
72 | | -export default { |
73 | | - components: { |
74 | | - XPanel, |
75 | | - XApiTable |
76 | | - }, |
77 | | - data() { |
78 | | - return { |
79 | | - code, |
80 | | - attrData, |
81 | | - hookData |
| 33 | +const api = { |
| 34 | + code: code.alert_api, |
| 35 | + attrData: [ |
| 36 | + { |
| 37 | + name: 'el', |
| 38 | + dec: '要绑定的Dom元素', |
| 39 | + type: 'String', |
| 40 | + value: '无', |
| 41 | + optional: '--' |
82 | 42 | } |
| 43 | + ], |
| 44 | + hookData: [ |
| 45 | + { |
| 46 | + name: 'close', |
| 47 | + dec: '关闭后触发的钩子', |
| 48 | + callback: '--', |
| 49 | + args: 'args1: $alert,被绑定的Dom元素的jquery对象' |
| 50 | + } |
| 51 | + ] |
| 52 | +} |
| 53 | +
|
| 54 | +@Component({ |
| 55 | + components: { |
| 56 | + XComponentTemplate |
83 | 57 | }, |
| 58 | +}) |
| 59 | +export default class extends Vue { |
| 60 | + card: any = card; |
| 61 | + api: any = api; |
| 62 | + |
84 | 63 | mounted() { |
85 | 64 | cd.alert({ |
86 | 65 | el: '.js-cd-alert', |
|
0 commit comments