1- <template >
2- <div
3- class =" q-tabs flex no-wrap"
4- :class =" classes"
5- >
6- <div
7- class =" q-tabs-head row"
8- ref =" tabs"
9- :class =" innerClasses"
10- >
11- <div ref =" scroller" class =" q-tabs-scroller row no-wrap" >
12- <slot name =" title" />
13- <div
14- v-if =" $q.theme !== 'ios'"
15- class =" relative-position self-stretch q-tabs-global-bar-container"
16- :class =" posbarClasses"
17- >
18- <div
19- ref =" posbar"
20- class =" q-tabs-bar q-tabs-global-bar"
21- @transitionend =" __updatePosbarTransition"
22- />
23- </div >
24- </div >
25- <div
26- ref =" leftScroll"
27- class =" row flex-center q-tabs-left-scroll"
28- @mousedown =" __animScrollTo(0)"
29- @touchstart =" __animScrollTo(0)"
30- @mouseup =" __stopAnimScroll"
31- @mouseleave =" __stopAnimScroll"
32- @touchend =" __stopAnimScroll"
33- >
34- <q-icon :name =" $q.icon.tabs.left" />
35- </div >
36- <div
37- ref =" rightScroll"
38- class =" row flex-center q-tabs-right-scroll"
39- @mousedown =" __animScrollTo(9999)"
40- @touchstart =" __animScrollTo(9999)"
41- @mouseup =" __stopAnimScroll"
42- @mouseleave =" __stopAnimScroll"
43- @touchend =" __stopAnimScroll"
44- >
45- <q-icon :name =" $q.icon.tabs.right" />
46- </div >
47- </div >
48-
49- <div class =" q-tabs-panes" >
50- <slot />
51- </div >
52- </div >
53- </template >
54-
55- <script >
561import { width , css , cssTransform } from '../../utils/dom'
572import { debounce } from '../../utils/debounce'
583import { QIcon } from '../icon'
@@ -71,9 +16,6 @@ export default {
7116 selectTabRouter : this . selectTabRouter
7217 }
7318 } ,
74- components: {
75- QIcon
76- },
7719 props : {
7820 value : String ,
7921 align : {
@@ -364,6 +306,12 @@ export default {
364306 }
365307 } , 5 )
366308 } ,
309+ __scrollToStart ( ) {
310+ this . __animScrollTo ( 0 )
311+ } ,
312+ __scrollToEnd ( ) {
313+ this . __animScrollTo ( 9999 )
314+ } ,
367315 __stopAnimScroll ( ) {
368316 clearInterval ( this . scrollTimer )
369317 } ,
@@ -390,6 +338,73 @@ export default {
390338 return done
391339 }
392340 } ,
341+ render ( h ) {
342+ return h ( 'div' , {
343+ staticClass : 'q-tabs flex no-wrap' ,
344+ 'class' : this . classes
345+ } , [
346+ h ( 'div' , {
347+ staticClass : 'q-tabs-head row' ,
348+ ref : 'tabs' ,
349+ 'class' : this . innerClasses
350+ } , [
351+ h ( 'div' , {
352+ ref : 'scroller' ,
353+ staticClass : 'q-tabs-scroller row no-wrap'
354+ } , [
355+ this . $slots . title ,
356+ process . env . THEME !== 'ios'
357+ ? h ( 'div' , {
358+ staticClass : 'relative-position self-stretch q-tabs-global-bar-container' ,
359+ 'class' : this . posbarClasses
360+ } , [
361+ h ( 'div' , {
362+ ref : 'posbar' ,
363+ staticClass : 'q-tabs-bar q-tabs-global-bar' ,
364+ on : {
365+ transitionend : this . __updatePosbarTransition
366+ }
367+ } )
368+ ] )
369+ : null
370+ ] ) ,
371+
372+ h ( 'div' , {
373+ ref : 'leftScroll' ,
374+ staticClass : 'row flex-center q-tabs-left-scroll' ,
375+ on : {
376+ mousedown : this . __scrollToStart ,
377+ touchstart : this . __scrollToStart ,
378+ mouseup : this . __stopAnimScroll ,
379+ mouseleave : this . __stopAnimScroll ,
380+ touchend : this . __stopAnimScroll
381+ }
382+ } , [
383+ h ( QIcon , {
384+ props : { name : this . $q . icon . tabs . left }
385+ } )
386+ ] ) ,
387+
388+ h ( 'div' , {
389+ ref : 'rightScroll' ,
390+ staticClass : 'row flex-center q-tabs-right-scroll' ,
391+ on : {
392+ mousedown : this . __scrollToEnd ,
393+ touchstart : this . __scrollToEnd ,
394+ mouseup : this . __stopAnimScroll ,
395+ mouseleave : this . __stopAnimScroll ,
396+ touchend : this . __stopAnimScroll
397+ }
398+ } , [
399+ h ( QIcon , {
400+ props : { name : this . $q . icon . tabs . right }
401+ } )
402+ ] )
403+ ] ) ,
404+
405+ h ( 'div' , { staticClass : 'q-tabs-panes' } , this . $slots . default )
406+ ] )
407+ } ,
393408 created ( ) {
394409 this . timer = null
395410 this . scrollTimer = null
@@ -428,4 +443,3 @@ export default {
428443 this . __updateScrollIndicator . cancel ( )
429444 }
430445}
431- </script >
0 commit comments