|
1 | 1 | <template>
|
2 | 2 | <div style="padding-bottom: 25px">
|
| 3 | + |
3 | 4 | <header>
|
| 5 | + <a href="?lang=en" class="lang-btn">English</a> |
| 6 | + <a href="?lang=zh" class="lang-btn">中文</a> |
| 7 | + |
4 | 8 | <div class="header-cont centered">
|
5 | 9 | <h1 class="title">Vuejs Dialog Plugin</h1>
|
6 | 10 | </div>
|
7 | 11 |
|
8 | 12 | </header>
|
9 | 13 |
|
10 | 14 | <section style="max-width: 350px; margin:auto; text-align: center">
|
11 |
| - <h2>Usage as a method</h2> |
| 15 | + <h2 class="title-case">{{ trans('content.titles.method_usage')}}</h2> |
12 | 16 | <hr/>
|
13 | 17 | <h4>
|
14 |
| - <button @click="showAlertDialog()">Alert Dialog - one button</button> |
| 18 | + <button @click="showAlertDialog()">{{ trans('content.examples.method_usage.1') }}</button> |
15 | 19 | </h4>
|
16 | 20 |
|
17 | 21 | <h4>
|
18 |
| - <button @click="showHtmlDialog()">Html Dialog - style/format content</button> |
| 22 | + <button @click="showHtmlDialog()">{{ trans('content.examples.method_usage.2') }}</button> |
19 | 23 | </h4>
|
20 | 24 |
|
21 | 25 | <h4>
|
22 |
| - <button @click="showBasicDialog()">Basic confirm - close instantly</button> |
| 26 | + <button @click="showBasicDialog()">{{ trans('content.examples.method_usage.3') }}</button> |
23 | 27 | </h4>
|
24 | 28 |
|
25 | 29 | <h4>
|
26 |
| - <button @click="showLoadingDialog()">Loading Dialog - Useful with ajax</button> |
| 30 | + <button @click="showLoadingDialog()">{{ trans('content.examples.method_usage.4') }}</button> |
27 | 31 | </h4>
|
28 | 32 |
|
29 | 33 | <h4>
|
30 |
| - <button @click="showReversedDialog()">Reversed Dialog - switch buttons</button> |
| 34 | + <button @click="showReversedDialog()">{{ trans('content.examples.method_usage.5') }}</button> |
31 | 35 | </h4>
|
32 | 36 |
|
33 | 37 | <h4>
|
34 |
| - <button @click="showAnimationFadeDialog()">Fade Dialog - Animation</button> |
| 38 | + <button @click="showAnimationFadeDialog()">{{ trans('content.examples.method_usage.6') }}</button> |
35 | 39 | </h4>
|
36 | 40 |
|
37 | 41 | <h4>
|
38 |
| - <button @click="showAnimationBounceDialog()">Bounce Dialog - Animation</button> |
| 42 | + <button @click="showAnimationBounceDialog()">{{ trans('content.examples.method_usage.7') }}</button> |
39 | 43 | </h4>
|
40 | 44 | </section>
|
41 | 45 |
|
42 | 46 | <section style="max-width: 350px; margin:auto; font-family: 'Noto Sans', sans-serif; text-align: center">
|
43 |
| - <h2>Usage as a directive</h2> |
| 47 | + <h2 class="title-case">{{ trans('content.titles.directive_usage')}}</h2> |
44 | 48 | <hr/>
|
45 | 49 |
|
46 | 50 | <h4>
|
47 |
| - <button v-confirm="`This is a message`"> |
48 |
| - Give it a string v-confirm="This is a message" |
| 51 | + <button v-confirm="trans('messages.directive_string')"> |
| 52 | + {{ trans('content.examples.directive_usage.1') }} v-confirm="'{{ trans('messages.directive_string') }}'" |
49 | 53 | </button>
|
50 | 54 | </h4>
|
51 | 55 |
|
52 | 56 | <h4>
|
53 |
| - <a href="http://example.com" v-confirm="'This will take you to "http://example.com". Proceed with caution'">Go to example.com</a> |
| 57 | + <a href="http://example.com" v-confirm="trans('messages.directive_link')"> |
| 58 | + {{ trans('content.examples.directive_usage.2') }} |
| 59 | + </a> |
54 | 60 | </h4>
|
55 | 61 |
|
56 | 62 | <h4>
|
57 | 63 | <button v-confirm="{
|
58 |
| - message: 'This dialog was also triggered using a v-confirm directive. It has both OK and CANCEL callback', |
| 64 | + message: trans('messages.directive_object'), |
59 | 65 | ok: clickOkHandler,
|
60 | 66 | cancel: clickCancelHandler}"
|
61 | 67 | >
|
62 |
| - Give it an object v-confirm="messageAndCallback" |
| 68 | + {{ trans('content.examples.directive_usage.3') }} |
63 | 69 | </button>
|
64 | 70 | </h4>
|
65 | 71 |
|
66 | 72 | <h4>
|
67 | 73 | <form @submit.prevent="submitDemo1Form()">
|
68 | 74 | <fieldset>
|
69 |
| - <input v-model="forms.demo1.name" type="text" name="name" placeholder="Your name"/> |
70 |
| - <button type="reset" v-confirm="'Changes would be discarded. Reset this form?'">Reset</button> |
71 |
| - <button type="submit" v-confirm="'Submit this form?'">submit</button> |
| 75 | + <input v-model="forms.demo1.name" type="text" name="name" :placeholder="trans('placeholders.your_name')"/> |
| 76 | + <button type="reset" v-confirm="trans('messages.form_reset')"> |
| 77 | + {{ trans('content.words.reset') }} |
| 78 | + </button> |
| 79 | + <button type="submit" v-confirm="trans('messages.form_submit')"> |
| 80 | + {{ trans('content.words.submit') }} |
| 81 | + </button> |
72 | 82 | </fieldset>
|
73 | 83 | </form>
|
74 | 84 | </h4>
|
75 | 85 | </section>
|
76 | 86 |
|
77 | 87 |
|
78 | 88 | <section style="max-width: 350px; margin:auto; font-family: 'Noto Sans', sans-serif; text-align: center">
|
79 |
| - <h2>Confirmation types</h2> |
| 89 | + <h2>{{ trans('content.titles.confirmation_types')}}</h2> |
80 | 90 | <hr/>
|
81 | 91 |
|
82 |
| - <p>Sometimes, you may want to be more strict by making sure a user really wants to proceed.</p> |
83 |
| - <p>The SOFT and HARD confirmation dialogs helps with that.</p> |
| 92 | + <p>{{ trans('content.descriptions.confirmation_types.1')}}</p> |
| 93 | + <p>{{ trans('content.descriptions.confirmation_types.2')}}</p> |
84 | 94 |
|
85 | 95 | <h4>
|
86 |
| - <button @click="showSoftConfirmDialog()">Soft confirm - multiple clicks required</button> |
| 96 | + <button @click="showSoftConfirmDialog()"> {{ trans('content.examples.confirmation_types.1') }}</button> |
87 | 97 | </h4>
|
88 | 98 |
|
89 | 99 | <h4>
|
90 |
| - <button @click="showHardConfirmDialog()">Hard confirm - verification text required</button> |
| 100 | + <button @click="showHardConfirmDialog()">{{ trans('content.examples.confirmation_types.2') }}</button> |
91 | 101 | </h4>
|
92 | 102 | </section>
|
93 | 103 |
|
94 | 104 | <notifications position="bottom left"></notifications>
|
95 | 105 |
|
96 | 106 | <a href="https://github.com/godofbrowser/vuejs-dialog"
|
97 |
| - v-confirm:soft="{html: true, message: exitMessage, cancelText: `Stay on Page`, okText: `Source Code`}"> |
| 107 | + v-confirm:soft="{html: true, message: exitMessage, cancelText: `Stay on Page`, okText: trans('content.words.source_code')}"> |
98 | 108 | <img style="position: absolute; top: 0; right: 0; border: 0;"
|
99 | 109 | src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67"
|
100 | 110 | alt="Fork me on GitHub"
|
|
128 | 138 | console.log('mounted app')
|
129 | 139 | },
|
130 | 140 | methods: {
|
| 141 | + trans, |
131 | 142 | submitDemo1Form(){
|
132 |
| - let msg = "Form Submited. Your Name: " |
133 |
| - msg += this.forms.demo1.name || 'The name field is empty' |
| 143 | + let msg = trans('placeholders.your_name') + ": " |
| 144 | + msg += this.forms.demo1.name || trans('messages.empty_name') |
134 | 145 | this.$notify(msg)
|
135 | 146 | },
|
136 | 147 | showAlertDialog(){
|
|
164 | 175 | })
|
165 | 176 | },
|
166 | 177 | showHtmlDialog(){
|
167 |
| - this.$dialog.alert(trans('messages.html'), {html: true, okText: 'Dismiss'}) |
| 178 | + this.$dialog.alert(trans('messages.html'), {html: true, okText: trans('content.words.dismiss')}) |
168 | 179 | },
|
169 | 180 | showAnimationBounceDialog(){
|
170 | 181 | this.$dialog.alert(trans('messages.html'), {html: true, animation: 'bounce'})
|
|
176 | 187 | showLoadingDialog(){
|
177 | 188 | this.$dialog.confirm(trans('messages.loading'), {
|
178 | 189 | html: true,
|
179 |
| - okText: 'Proceed', |
| 190 | + okText: trans('content.words.proceed'), |
180 | 191 | loader: true
|
181 | 192 | }).then((dialog) => {
|
182 | 193 | setTimeout(() => {
|
|
192 | 203 | showReversedDialog(){
|
193 | 204 | this.$dialog.confirm(trans('messages.reverse'), {
|
194 | 205 | html: true,
|
195 |
| - okText: 'Proceed', |
| 206 | + okText: trans('content.words.proceed'), |
196 | 207 | loader: true,
|
197 | 208 | reverse: true
|
198 | 209 | }).then((dialog) => {
|
|
0 commit comments