diff --git a/src/components/tabbar/tabbar.json b/src/components/tabbar/tabbar.json new file mode 100644 index 0000000..4f0a3f0 --- /dev/null +++ b/src/components/tabbar/tabbar.json @@ -0,0 +1,5 @@ +{ + "component": true, + "styleIsolation": "apply-shared", + "usingComponents": {} +} diff --git a/src/components/tabbar/tabbar.scss b/src/components/tabbar/tabbar.scss new file mode 100644 index 0000000..be3bd8e --- /dev/null +++ b/src/components/tabbar/tabbar.scss @@ -0,0 +1,24 @@ +.tabbar { + position: fixed; + bottom: 0; + left: 0; + z-index: 2; + width: 100vw; + .tabbar-img { + width: 100%; + } + .tabbar-wrap { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: flex; + justify-content: space-between; + align-items: center; + .tabbar-click { + flex: 1; + height: 100%; + } + } +} diff --git a/src/components/tabbar/tabbar.ts b/src/components/tabbar/tabbar.ts new file mode 100644 index 0000000..2e7f02b --- /dev/null +++ b/src/components/tabbar/tabbar.ts @@ -0,0 +1,51 @@ +const app = getApp(); + +Component({ + properties: { + current: { + type: Number, + value: 1, + }, + }, + + data: { + imageUrl: app.globalData.imageUrl, + Timestamp: new Date().getTime(), + }, + + lifetimes: { + attached() { + this.setData({ + Timestamp: new Date().getTime(), + }); + }, + }, + + methods: { + handleTabbar1() { + wx.reLaunch({ + url: "/pages/1/index", + }); + }, + handleTabbar2() { + wx.reLaunch({ + url: "/pages/4/index", + }); + }, + handleTabbar3() { + wx.navigateTo({ + url: "/pages/7/index", + }); + }, + handleTabbar4() { + wx.reLaunch({ + url: "/pages/5/index", + }); + }, + handleTabbar5() { + wx.reLaunch({ + url: "/pages/6/index", + }); + }, + }, +}); diff --git a/src/components/tabbar/tabbar.wxml b/src/components/tabbar/tabbar.wxml new file mode 100644 index 0000000..a46e90b --- /dev/null +++ b/src/components/tabbar/tabbar.wxml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/pages/1/index.json b/src/pages/1/index.json index a97367d..9d31b77 100644 --- a/src/pages/1/index.json +++ b/src/pages/1/index.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "tabbar": "/components/tabbar/tabbar" + } } diff --git a/src/pages/1/index.scss b/src/pages/1/index.scss index a162fb2..147935f 100644 --- a/src/pages/1/index.scss +++ b/src/pages/1/index.scss @@ -20,33 +20,6 @@ background-color: transparent; } - -.tabbar { - position: fixed; - bottom: 0; - left: 0; - z-index: 2; - width: 100vw; - padding-bottom: 20rpx; - .tabbar-img { - width: 100%; - } - .tabbar-wrap { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - justify-content: space-between; - align-items: center; - .tabbar-click { - flex: 1; - height: 160rpx; - } - } -} - .float1 { position: fixed; bottom: 0; diff --git a/src/pages/1/index.ts b/src/pages/1/index.ts index 7a36e70..dab5fd1 100644 --- a/src/pages/1/index.ts +++ b/src/pages/1/index.ts @@ -28,31 +28,6 @@ Page({ }); wx.setStorageSync("1float1", "1"); }, - handleTabbar1() { - wx.reLaunch({ - url: "/pages/1/index", - }); - }, - handleTabbar2() { - wx.reLaunch({ - url: "/pages/4/index", - }); - }, - handleTabbar3() { - wx.navigateTo({ - url: "/pages/7/index", - }); - }, - handleTabbar4() { - wx.reLaunch({ - url: "/pages/5/index", - }); - }, - handleTabbar5() { - wx.reLaunch({ - url: "/pages/6/index", - }); - }, }); export {}; diff --git a/src/pages/1/index.wxml b/src/pages/1/index.wxml index d148e78..3f2e9ab 100644 --- a/src/pages/1/index.wxml +++ b/src/pages/1/index.wxml @@ -3,14 +3,4 @@ - - - - - - - - - - - + diff --git a/src/pages/4/index.json b/src/pages/4/index.json index a97367d..9d31b77 100644 --- a/src/pages/4/index.json +++ b/src/pages/4/index.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "tabbar": "/components/tabbar/tabbar" + } } diff --git a/src/pages/4/index.scss b/src/pages/4/index.scss index e5d9779..cc9825a 100644 --- a/src/pages/4/index.scss +++ b/src/pages/4/index.scss @@ -10,29 +10,3 @@ height: 200rpx; background-color: transparent; } - -.tabbar { - position: fixed; - bottom: 0; - left: 0; - width: 100vw; - padding-bottom: 20rpx; - .tabbar-img { - width: 100%; - } - .tabbar-wrap { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - justify-content: space-between; - align-items: center; - .tabbar-click { - flex: 1; - height: 160rpx; - } - } -} - diff --git a/src/pages/4/index.ts b/src/pages/4/index.ts index 3932821..71146ef 100644 --- a/src/pages/4/index.ts +++ b/src/pages/4/index.ts @@ -1,5 +1,3 @@ -const _app = getApp(); - Page({ data: {}, onLoad() {}, @@ -14,31 +12,6 @@ Page({ url: "/pages/6/index", }); }, - handleTabbar1() { - wx.reLaunch({ - url: "/pages/1/index", - }); - }, - handleTabbar2() { - wx.reLaunch({ - url: "/pages/4/index", - }); - }, - handleTabbar3() { - wx.navigateTo({ - url: "/pages/7/index", - }); - }, - handleTabbar4() { - wx.reLaunch({ - url: "/pages/5/index", - }); - }, - handleTabbar5() { - wx.reLaunch({ - url: "/pages/6/index", - }); - }, }); export {}; diff --git a/src/pages/4/index.wxml b/src/pages/4/index.wxml index 6b3a945..767a3e1 100644 --- a/src/pages/4/index.wxml +++ b/src/pages/4/index.wxml @@ -1,12 +1,4 @@ + - - - - - - - - - - + diff --git a/src/pages/5/index.json b/src/pages/5/index.json index a97367d..9d31b77 100644 --- a/src/pages/5/index.json +++ b/src/pages/5/index.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "tabbar": "/components/tabbar/tabbar" + } } diff --git a/src/pages/5/index.scss b/src/pages/5/index.scss index 135ee60..b818a51 100644 --- a/src/pages/5/index.scss +++ b/src/pages/5/index.scss @@ -1,29 +1,4 @@ -.page{ +.page { width: 100vw; padding-bottom: 260rpx; } - -.tabbar { - position: fixed; - bottom: 0; - left: 0; - width: 100vw; - padding-bottom: 20rpx; - .tabbar-img { - width: 100%; - } - .tabbar-wrap { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - justify-content: space-between; - align-items: center; - .tabbar-click { - flex: 1; - height: 160rpx; - } - } -} diff --git a/src/pages/5/index.ts b/src/pages/5/index.ts index 38291e4..8caf6fe 100644 --- a/src/pages/5/index.ts +++ b/src/pages/5/index.ts @@ -1,34 +1,9 @@ -const _app = getApp(); - Page({ data: {}, onLoad() {}, handleTap1() { - wx.navigateBack(); - }, - handleTabbar1() { - wx.reLaunch({ - url: "/pages/1/index", - }); - }, - handleTabbar2() { - wx.reLaunch({ - url: "/pages/4/index", - }); - }, - handleTabbar3() { wx.navigateTo({ - url: "/pages/7/index", - }); - }, - handleTabbar4() { - wx.reLaunch({ - url: "/pages/5/index", - }); - }, - handleTabbar5() { - wx.reLaunch({ - url: "/pages/6/index", + url: "/pages/3/index", }); }, }); diff --git a/src/pages/5/index.wxml b/src/pages/5/index.wxml index b9ccf2a..cfe36f0 100644 --- a/src/pages/5/index.wxml +++ b/src/pages/5/index.wxml @@ -1,13 +1,4 @@ - - - - - - - - - - + diff --git a/src/pages/6/index.json b/src/pages/6/index.json index a97367d..9d31b77 100644 --- a/src/pages/6/index.json +++ b/src/pages/6/index.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": { + "tabbar": "/components/tabbar/tabbar" + } } diff --git a/src/pages/6/index.scss b/src/pages/6/index.scss index 1d90ce9..e859566 100644 --- a/src/pages/6/index.scss +++ b/src/pages/6/index.scss @@ -1,28 +1,3 @@ -.page{ +.page { width: 100vw; } - -.tabbar { - position: fixed; - bottom: 0; - left: 0; - width: 100vw; - padding-bottom: 20rpx; - .tabbar-img { - width: 100%; - } - .tabbar-wrap { - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - display: flex; - justify-content: space-between; - align-items: center; - .tabbar-click { - flex: 1; - height: 160rpx; - } - } -} diff --git a/src/pages/6/index.ts b/src/pages/6/index.ts index e16cbf1..048953e 100644 --- a/src/pages/6/index.ts +++ b/src/pages/6/index.ts @@ -1,38 +1,8 @@ -const _app = getApp(); - Page({ data: {}, onLoad() {}, handleTap1() { - wx.navigateTo({ - url: "/pages/3/index", - }) - }, - - handleTabbar1() { - wx.reLaunch({ - url: "/pages/1/index", - }); - }, - handleTabbar2() { - wx.reLaunch({ - url: "/pages/4/index", - }); - }, - handleTabbar3() { - wx.navigateTo({ - url: "/pages/7/index", - }); - }, - handleTabbar4() { - wx.reLaunch({ - url: "/pages/5/index", - }); - }, - handleTabbar5() { - wx.reLaunch({ - url: "/pages/6/index", - }); + wx.navigateBack(); }, }); diff --git a/src/pages/6/index.wxml b/src/pages/6/index.wxml index c5ab0b9..2e06ca4 100644 --- a/src/pages/6/index.wxml +++ b/src/pages/6/index.wxml @@ -1,13 +1,4 @@ - - - - - - - - - - +