93
93
< div id ="BG "> </ div >
94
94
< div id ="app " v-cloak >
95
95
< v-app v-if ="box " :style ="appViewStyle ">
96
- < v-app-bar app v-bind ="appBarBind " :class ="appBarClass " :value ="!isHidedSearchBar " v-touch ="{ up: () => isHidedSearchBar = true } ">
96
+ < v-app-bar
97
+ ref ="appBar "
98
+ v-bind ="appBarBind "
99
+ :class ="!$refs.appBar || $refs.appBar.isActive ? 'safe' : undefined "
100
+ :value ="!isHidedSearchBar "
101
+ v-touch ="{ up: () => isHidedSearchBar = true } "
102
+ >
97
103
<!-- 搜索条 -->
98
104
< v-autocomplete v-bind ="ui.searchBar " :label ="title " @click ="ui.searchDialog.show = true " hide-no-data hide-details solo >
99
105
< template #prepend-inner >
296
302
< v-avatar size ="32 "> < v-icon > mdi-dock-top</ v-icon > </ v-avatar >
297
303
</ v-btn >
298
304
</ v-list-item >
305
+ < v-list-item class ="mt-4 ">
306
+ < v-switch
307
+ dense
308
+ class ="mt-0 "
309
+ label ="自动顶栏 "
310
+ v-model ="isAutoSearchBar "
311
+ @change ="saveUserCfgs "
312
+ :persistent-hint ="true "
313
+ hint ="顶栏跟随主屏滚动 "
314
+ >
315
+ </ v-switch >
316
+ < v-spacer > </ v-spacer >
317
+ < v-btn fab small text >
318
+ < v-avatar size ="32 "> < v-icon > mdi-format-align-top</ v-icon > </ v-avatar >
319
+ </ v-btn >
320
+ </ v-list-item >
299
321
< v-list-item class ="mt-4 ">
300
322
< v-switch
301
323
dense
312
334
< v-avatar size ="32 "> < v-icon > mdi-dock-bottom</ v-icon > </ v-avatar >
313
335
</ v-btn >
314
336
</ v-list-item >
337
+ < v-list-item class ="mt-4 ">
338
+ < v-switch
339
+ dense
340
+ class ="mt-0 "
341
+ label ="自动底栏 "
342
+ v-model ="isAutoNaviBottom "
343
+ @change ="saveUserCfgs "
344
+ :persistent-hint ="true "
345
+ hint ="底栏跟随主屏滚动 "
346
+ >
347
+ </ v-switch >
348
+ < v-spacer > </ v-spacer >
349
+ < v-btn fab small text >
350
+ < v-avatar size ="32 "> < v-icon > mdi-format-align-bottom</ v-icon > </ v-avatar >
351
+ </ v-btn >
352
+ </ v-list-item >
315
353
<!-- <v-list-item class="mt-4">
316
354
<v-switch
317
355
dense
456
494
</ v-list >
457
495
</ v-navigation-drawer >
458
496
<!-- 主页 -->
459
- < v-main v-scroll ="onScroll ">
497
+ < v-main class =" appBarBind.app ? 'safe' : '' " v-scroll ="onScroll ">
460
498
< v-snackbar top app v-model ="ui.snackbar.show " v-bind ="ui.snackbar "> {{ui.snackbar.msg}}</ v-snackbar >
461
499
<!-- 主页 -->
462
500
< v-container
@@ -1098,14 +1136,7 @@ <h2 :style="appTitleStyle">{{curbak.name}}</h2>
1098
1136
</ v-container >
1099
1137
</ v-main >
1100
1138
<!-- 底部 -->
1101
- < v-bottom-navigation
1102
- app
1103
- grow
1104
- color ="primary "
1105
- :value ="view "
1106
- :input-value ="!isHidedNaviBottom "
1107
- v-touch ="{ down: () => isHidedNaviBottom = true } "
1108
- >
1139
+ < v-bottom-navigation ref ="naviBar " v-bind ="naviBarBind " v-touch ="{ down: () => isHidedNaviBottom = true } ">
1109
1140
< v-progress-linear :active ="isLoading " height ="2 " absolute top indeterminate > </ v-progress-linear >
1110
1141
< v-btn @click ="switchView('') " value =""> 首页< v-icon > mdi-home</ v-icon > </ v-btn >
1111
1142
< v-btn @click ="switchView('app') " value ="app "> 应用< v-icon > mdi-application</ v-icon > </ v-btn >
@@ -1411,6 +1442,17 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
1411
1442
this . box . usercfgs . isHidedSearchBar = val === true
1412
1443
}
1413
1444
} ,
1445
+ isAutoSearchBar : {
1446
+ get ( ) {
1447
+ return this . box . usercfgs . isAutoSearchBar
1448
+ } ,
1449
+ set ( val ) {
1450
+ this . box . usercfgs . isAutoSearchBar = val === true
1451
+ if ( val === false && ! this . isHidedSearchBar ) {
1452
+ this . $refs . appBar . isActive = true
1453
+ }
1454
+ }
1455
+ } ,
1414
1456
isHidedAppIcons : {
1415
1457
get ( ) {
1416
1458
return this . box . usercfgs . isHidedAppIcons || this . isWallpaperMode
@@ -1427,6 +1469,17 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
1427
1469
this . box . usercfgs . isHidedNaviBottom = val === true
1428
1470
}
1429
1471
} ,
1472
+ isAutoNaviBottom : {
1473
+ get ( ) {
1474
+ return this . box . usercfgs . isAutoNaviBottom
1475
+ } ,
1476
+ set ( val ) {
1477
+ this . box . usercfgs . isAutoNaviBottom = val === true
1478
+ if ( val === false && ! this . isHidedNaviBottom ) {
1479
+ this . $refs . naviBar . isActive = true
1480
+ }
1481
+ }
1482
+ } ,
1430
1483
// 判断是否有壁纸
1431
1484
isWallpaper ( ) {
1432
1485
return ! ! this . box . usercfgs . bgimg
@@ -1478,20 +1531,29 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
1478
1531
return style
1479
1532
} ,
1480
1533
appBarBind ( ) {
1534
+ const app = true
1481
1535
const isEmptyLight = this . isWebApp && ! this . isDarkMode && ! this . isWallpaper
1482
1536
const color = isEmptyLight ? 'primary' : 'transparent'
1483
1537
const flat = color === 'transparent'
1484
- const hideOnScroll = false
1538
+ const hideOnScroll = ! this . isHidedSearchBar && this . isAutoSearchBar
1485
1539
const collapseOnScroll = false
1486
- return { color, flat, hideOnScroll, collapseOnScroll }
1487
- } ,
1488
- appBarClass ( ) {
1489
- return ! this . isHidedSearchBar ? 'safe' : ''
1540
+ const scrollThreshold = 20
1541
+ return { app, color, flat, hideOnScroll, collapseOnScroll, scrollThreshold }
1490
1542
} ,
1491
1543
searchBarBind ( ) {
1492
1544
const color = this . isDarkMode ? null : 'primary'
1493
1545
return { color }
1494
1546
} ,
1547
+ naviBarBind ( ) {
1548
+ const app = true
1549
+ const grow = true
1550
+ const color = 'primary'
1551
+ const value = this . view
1552
+ const inputValue = ! this . isHidedNaviBottom
1553
+ const hideOnScroll = ! this . isHidedNaviBottom && this . isAutoNaviBottom
1554
+ const scrollThreshold = 160
1555
+ return { app, grow, color, value, inputValue, hideOnScroll, scrollThreshold }
1556
+ } ,
1495
1557
appIconFontStyle ( ) {
1496
1558
const style = {
1497
1559
'font-size' : '10px' ,
@@ -2070,7 +2132,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
2070
2132
// 修改应用会话
2071
2133
updateAppSession ( session ) {
2072
2134
session . datas . forEach ( ( dat ) => {
2073
- // 如果属性值是 undefinded 或 null, 则修改为 ``, 否则转为字符串
2135
+ // 如果属性值是 undefined 或 null, 则修改为 ``, 否则转为字符串
2074
2136
dat . val = ! _ . isNil ( dat . val ) ? _ . toString ( dat . val ) : ''
2075
2137
} )
2076
2138
const key = 'chavy_boxjs_sessions'
0 commit comments