32
32
GitHub →
33
33
</a >
34
34
</p >
35
-
36
35
<h2 id =" features" ><a href =" #features" >#</a > {{ zh ? '功能' : 'Features' }}</h2 >
37
36
<ul >
38
37
<li >{{ zh ? '可以选择限制行数与/或最大高度,无需指定行高。' : 'Clamps text with max lines and/or max height. No need to specify line height.' }}</li >
39
38
<li >{{ zh ? '支持在布局变化时自动更新。' : 'Automatically updates upon layout change.' }}</li >
40
39
<li >{{ zh ? '支持展开/收起被截断部分内容。' : 'The clamped text can be expanded/collapsed.' }}</li >
41
40
<li >{{ zh ? '支持自定义截断文本前后内容,并且进行响应式更新。' : 'Customizable and responsive content before/after clamped text.' }}</li >
42
41
</ul >
43
-
44
42
<h2 id =" demo" ><a href =" #demo" >#</a > Demo</h2 >
45
43
<div
46
44
class =" divider text-center"
224
222
</template >
225
223
</v-clamp >
226
224
</section >
225
+ <div
226
+ class =" divider text-center"
227
+ data-content =" ↓ `clampchange` event"
228
+ />
229
+ <section class =" case" >
230
+ <div class =" form-horizontal" >
231
+ <div class =" form-group" >
232
+ <label
233
+ class =" form-label col-5 col-sm-12"
234
+ for =" lines3"
235
+ >
236
+ {{ zh ? '最大行数' : 'Max lines' }}
237
+ </label >
238
+ <div
239
+ class =" col-7 col-sm-12"
240
+ >
241
+ <input
242
+ id =" lines3"
243
+ v-model.number =" lines3"
244
+ class =" form-input"
245
+ type =" number"
246
+ min =" 1"
247
+ max =" 8"
248
+ step =" 1"
249
+ >
250
+ </div >
251
+ </div >
252
+ <div class =" form-group" >
253
+ <label
254
+ class =" form-label col-5 col-sm-12"
255
+ for =" width3"
256
+ >
257
+ {{ zh ? '容器宽度' : 'Container width' }}
258
+ </label >
259
+ <div
260
+ class =" col-7 col-sm-12 tooltip"
261
+ :data-tooltip =" `${width3}px`"
262
+ >
263
+ <input
264
+ id =" width3"
265
+ v-model =" width3"
266
+ class =" slider"
267
+ type =" range"
268
+ min =" 240"
269
+ max =" 600"
270
+ >
271
+ </div >
272
+ </div >
273
+ <div
274
+ v-if =" !zh"
275
+ class =" form-group"
276
+ >
277
+ <div class =" col-5 col-sm-12" >
278
+ <label class =" form-checkbox" >
279
+ <input
280
+ v-model =" hyphens3"
281
+ type =" checkbox"
282
+ >
283
+ <i class =" form-icon" />
284
+ CSS <code >hyphens</code >
285
+ </label >
286
+ </div >
287
+ </div >
288
+ </div >
289
+ <v-clamp
290
+ :class =" {
291
+ demo: true,
292
+ hyphens: hyphens3
293
+ }"
294
+ :max-lines =" lines3"
295
+ autoresize
296
+ :style =" {
297
+ width: `${width3}px`
298
+ }"
299
+ @clampchange =" clamped3 = $event"
300
+ >
301
+ {{ zh ? textZh : text }}
302
+ </v-clamp >
303
+ <p class =" mt-2" >
304
+ {{ zh ? '截断状态:' + (clamped3 ? '已截断' : '未截断') : 'Clamped: ' + (clamped3 ? 'Yes' : 'No')}}
305
+ </p >
306
+ </section >
227
307
<h2 id =" usage" ><a href =" #usage" >#</a > {{ zh ? '使用方法' : 'Usage' }}</h2 >
228
308
<div
229
309
class =" divider text-center"
@@ -392,6 +472,19 @@ export default {
392
472
</li >
393
473
</ul >
394
474
</section >
475
+ <div
476
+ class =" divider text-center"
477
+ data-content =" ↓ Events"
478
+ />
479
+ <section >
480
+ <ul >
481
+ <li >
482
+ <p ><code >clampchange</code ></p >
483
+ <p >{{ zh ? '截断状态变化时触发。' : 'Emitted when clamp state changes.' }}</p >
484
+ <p >{{ parameterText }}<code >(clamped: Boolean)</code ></p >
485
+ </li >
486
+ </ul >
487
+ </section >
395
488
<footer >
396
489
<p v-if =" zh" >由 <a href =" https://github.com/Justineo" >@Justineo</a > 创作。</p >
397
490
<p v-else >Made by <a href =" https://github.com/Justineo" >@Justineo</a >.</p >
@@ -417,9 +510,9 @@ hljs.registerLanguage('javascript', javascript)
417
510
hljs .registerLanguage (' diff' , diff)
418
511
hljs .registerLanguage (' shell' , shell)
419
512
420
- let search = location .search .replace (/ ^ \? / , ' ' )
421
- let query = qs .parse (search)
422
- let zh = query .lang === ' zh'
513
+ const search = location .search .replace (/ ^ \? / , ' ' )
514
+ const query = qs .parse (search)
515
+ const zh = query .lang === ' zh'
423
516
424
517
export default {
425
518
name: ' app' ,
@@ -435,6 +528,10 @@ export default {
435
528
height: ' calc(48px + 12em)' ,
436
529
width2: 600 ,
437
530
hyphens2: true ,
531
+ lines3: 5 ,
532
+ width3: 600 ,
533
+ hyphens3: true ,
534
+ clamped3: false ,
438
535
text:
439
536
' Vue (pronounced /vjuː/, like view) is a progressive framework for building user interfaces. Unlike other monolithic frameworks, Vue is designed from the ground up to be incrementally adoptable. The core library is focused on the view layer only, and is easy to pick up and integrate with other libraries or existing projects. On the other hand, Vue is also perfectly capable of powering sophisticated Single-Page Applications when used in combination with modern tooling and supporting libraries.' ,
440
537
textZh:
@@ -446,6 +543,9 @@ export default {
446
543
computed: {
447
544
defaultText () {
448
545
return this .zh ? ' 默认值:' : ' Default:'
546
+ },
547
+ parameterText () {
548
+ return this .zh ? ' 回调参数:' : ' Callback parameter list:'
449
549
}
450
550
},
451
551
watch: {
@@ -548,6 +648,7 @@ summary
548
648
display flex
549
649
align-items center
550
650
margin-bottom 0.5em
651
+ cursor pointer
551
652
552
653
h4
553
654
margin 0
0 commit comments