@jx3box/jx3box-vue3-ui 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,23 +10,8 @@
10
10
  // height:100%;
11
11
  box-sizing: border-box;
12
12
 
13
- overflow-y: auto;
14
- &::-webkit-scrollbar {
15
- width: 4px;
16
- }
17
- &::-webkit-scrollbar-track,
18
- &::-webkit-scrollbar-track-piece {
19
- background-color: #fafafa;
20
- border-radius: 6px;
21
- }
22
- &::-webkit-scrollbar-thumb {
23
- background-color: #eee;
24
- border-radius: 6px;
25
- }
26
- &::-webkit-scrollbar-button,
27
- &::-webkit-scrollbar-corner,
28
- &::-webkit-resizer {
29
- display: none;
13
+ &.show-toggle {
14
+ background-color: @bg-light;
30
15
  }
31
16
  }
32
17
 
@@ -93,9 +78,111 @@
93
78
  // // 平板横屏
94
79
  @media screen and (max-width: @smallpc) {
95
80
  .c-sidebar-right {
96
- .ps;
97
- .w(auto);
98
- border-left: none;
81
+ .pr;
82
+ width: 100%;
83
+ top: 0;
84
+ &.show-toggle {
85
+ background-color: #fff;
86
+ .pf;
87
+ .rt(0,@header-height + @bread-height);
88
+ .z(400);
89
+ bottom: 0;
90
+ .w(@aside-right);
91
+ }
92
+ }
93
+ }
94
+
95
+ .c-sidebar-right-inner {
96
+ .size(100%);
97
+ overflow-y: auto;
98
+
99
+ &::-webkit-scrollbar {
100
+ width: 4px;
101
+ }
102
+
103
+ &::-webkit-scrollbar-track,
104
+ &::-webkit-scrollbar-track-piece {
105
+ background-color: #fafafa;
106
+ border-radius: 6px;
107
+ }
108
+
109
+ &::-webkit-scrollbar-thumb {
110
+ background-color: #eee;
111
+ border-radius: 6px;
112
+ }
113
+
114
+ &::-webkit-scrollbar-button,
115
+ &::-webkit-scrollbar-corner,
116
+ &::-webkit-resizer {
117
+ display: none;
118
+ }
119
+ }
120
+ // 折叠相关逻辑
121
+ .c-sidebar-right-toggle {
122
+ display: block;
123
+ .pa;
124
+ .lb(-21px, calc(50% - 20px));
125
+ width: 20px;
126
+ height: 40px;
127
+ line-height: 40px;
128
+ .pointer;
129
+ text-align: center;
130
+ background-color: @bg-light;
131
+ border-left: 1px solid #eee;
132
+ border-top: 1px solid #eee;
133
+ border-bottom: 1px solid #eee;
134
+ border-radius: 0px 2px 2px 0px;
135
+ font-size: 16px;
136
+ color: #999;
137
+
138
+ &:hover {
139
+ color: #222;
140
+ }
141
+
142
+ &.close-sidebar-right {
143
+ left: 0;
144
+ }
145
+
146
+ svg {
147
+ fill: @color;
148
+ }
149
+ }
150
+
151
+ .closeLeftSidebar() {
152
+ transition: 0.2s ease-in-out;
153
+ transform: translateX(100%);
154
+ }
155
+
156
+ .openLeftSidebar() {
157
+ transition: 0.2s ease-in-out;
158
+ transform: translateX(0);
159
+ }
160
+
161
+ .c-sidebar-right.is-close {
162
+ .closeLeftSidebar();
163
+
164
+ .c-sidebar-right-toggle {
165
+ transition: 0.2s ease-in-out;
166
+ transform: translateX(-100%);
167
+ }
168
+ }
169
+
170
+ .c-sidebar-right.is-open {
171
+ .openLeftSidebar();
172
+
173
+ .c-sidebar-right-toggle {
174
+ transition: 0.2s ease-in-out;
175
+ transform: translateX(0);
176
+ }
177
+ }
178
+
179
+ @media screen and (max-width: @ipad) {
180
+ .c-sidebar-right-toggle {
181
+ // .none;
182
+ }
183
+
184
+ .c-sidebar-right.isopen {
185
+ box-shadow: 2px 0 3px rgba(0, 0, 0, 0.1);
99
186
  }
100
187
  }
101
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jx3box/jx3box-vue3-ui",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "JX3BOX Vue3 UI",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/App.vue CHANGED
@@ -68,7 +68,7 @@
68
68
  :allowGift="true"
69
69
  />
70
70
  <Comment category="post" id="19382"></Comment>
71
- <RightSidebar>
71
+ <RightSidebar :show-toggle="true">
72
72
  <PostTopic type="bps" :id="48857"></PostTopic>
73
73
  <div id="directory"></div>
74
74
  </RightSidebar>
@@ -1,22 +1,58 @@
1
1
  <template>
2
- <aside class="c-sidebar-right c-sidebar" v-if="!isApp">
3
- <slot></slot>
2
+ <aside class="c-sidebar-right c-sidebar" v-if="!isApp" :class="[isOpen ? 'is-open' : 'is-close', {'show-toggle': showToggle}]">
3
+ <div class="c-sidebar-right-inner">
4
+ <slot></slot>
5
+ </div>
6
+
7
+ <template v-if="showToggle">
8
+ <span
9
+ class="c-sidebar-right-toggle"
10
+ :class="!isOpen && 'close-sidebar-right'"
11
+ @click="toggleRightSide"
12
+ :title="isOpen ? '收起侧边栏' : '打开侧边栏'"
13
+ >
14
+ <el-icon>
15
+ <ArrowLeft v-show="!isOpen" />
16
+ <ArrowRight v-show="isOpen" />
17
+ </el-icon>
18
+ </span>
19
+ </template>
4
20
  </aside>
5
21
  </template>
6
22
 
7
23
  <script>
8
24
  import { isApp } from "../assets/js/app.js";
25
+ import Bus from "../utils/bus";
9
26
  export default {
10
27
  name: "RightSidebar",
11
- props: [],
28
+ props: {
29
+ // 展示收起按钮
30
+ showToggle: {
31
+ type: Boolean,
32
+ default: false,
33
+ },
34
+ },
12
35
  data: function () {
13
36
  return {
37
+ isOpen: true,
14
38
  isApp: isApp(),
15
39
  };
16
40
  },
17
41
  computed: {},
18
- methods: {},
19
- mounted: function () {},
42
+ methods: {
43
+ toggleRightSide: function () {
44
+ Bus.emit("toggleRightSide", !this.isOpen);
45
+ },
46
+ },
47
+ mounted: function () {
48
+ Bus.on("toggleRightSide", (data) => {
49
+ this.isOpen = data;
50
+ });
51
+
52
+ if (window.innerWidth <= 1440) {
53
+ this.isOpen = false;
54
+ }
55
+ },
20
56
  };
21
57
  </script>
22
58