File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/components/index-list Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 99 @pulling-down =" onPullingDown"
1010 @pulling-up =" onPullingUp" >
1111 <div class =" cube-index-list-content" ref =" content" >
12- <h1 class =" cube-index-list-title" v-if =" title " ref =" title" @click =" titleClick" >
13- {{ title }}
12+ <h1 class =" cube-index-list-title" v-if =" hasTitle " ref =" title" @click =" titleClick" >
13+ < slot name = " title " > {{ title }}</ slot >
1414 </h1 >
1515 <ul >
1616 <slot >
126126 }
127127 },
128128 computed: {
129+ hasTitle () {
130+ return this .title || this .$slots .title
131+ },
129132 fixedTitle () {
130- this .title && ! this .titleHeight && this ._caculateTitleHeight ()
133+ this .hasTitle && ! this .titleHeight && this ._caculateTitleHeight ()
131134
132135 return this .scrollY <= - this .titleHeight && this .data [this .currentIndex ] ? this .data [this .currentIndex ].name : ' '
133136 },
151154 },
152155 mounted () {
153156 this .$nextTick (() => {
154- this .title && this ._caculateTitleHeight ()
155- this ._calculateHeight ()
157+ this .refresh ()
156158 })
157159 },
158160 methods: {
159161 /* TODO: remove refresh next minor version */
160162 refresh () {
163+ this ._caculateTitleHeight ()
164+ this ._calculateHeight ()
161165 this .$refs .scroll .refresh ()
162166 },
163167 selectItem (item ) {
238242 },
239243 title (newVal ) {
240244 this .$nextTick (() => {
241- this ._caculateTitleHeight ()
242- this ._calculateHeight ()
245+ this .refresh ()
243246 })
244247 },
245248 diff (newVal ) {
You can’t perform that action at this time.
0 commit comments