Skip to content

Commit 83f765c

Browse files
author
youknowznm
committed
modified component structure
1 parent 492b859 commit 83f765c

File tree

5 files changed

+39
-41
lines changed

5 files changed

+39
-41
lines changed

src/App.vue

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,12 @@
8383

8484
<!-- 字符串过滤器 -->
8585
<li>
86-
<form class="navbar-form">
87-
<input
88-
type="text"
89-
class="search-box form-control"
90-
placeholder="过滤标题、内容、时间戳"
91-
v-model="queryString"
92-
@keyup="filterBy(currentCategoryId, queryString)">
93-
</form>
86+
<input
87+
type="text"
88+
class="search-box form-control"
89+
placeholder="过滤标题、内容、时间戳"
90+
v-model="queryString"
91+
@keyup="filterBy(currentCategoryId, queryString)">
9492
</li>
9593
<!-- -->
9694

@@ -113,6 +111,7 @@
113111
</template>
114112

115113
<script>
114+
import helpers from './helpers';
116115
import storeUtil from './storage';
117116
import memoItem from './components/memoItem.vue';
118117
import memoEditor from './components/memoEditor.vue';
@@ -134,6 +133,7 @@ export default {
134133
2: '生活',
135134
3: '学习',
136135
},
136+
helpers,
137137
};
138138
},
139139
components: {
@@ -233,6 +233,11 @@ export default {
233233
this.filterBy(0, this.queryString);
234234
this.sortByTimeOrTitle('title');
235235
},
236+
watch: {
237+
memosFiltered () {
238+
helpers.resizeMemos();
239+
}
240+
}
236241
};
237242
</script>
238243

src/helpers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ const initCanvas = (canvasEle, colorsEle, controllersEle, imageData) => {
111111
let stX, stY;
112112
switch (evt.type) {
113113
case 'touchstart':
114-
stX = evt.targetTouches[0].clientX;
115-
stY = evt.targetTouches[0].clientY;
114+
stX = evt.touches[0].clientX;
115+
stY = evt.touches[0].clientY;
116116
break;
117117
default:
118118
stX = evt.offsetX;

src/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ Vue.config.debug = true;
77
new Vue({
88
el: 'body',
99
components: { App }
10-
})
10+
});
1111

12-
//
13-
$(window).on('resize load', () => {
12+
// 调整所有 memo 的尺寸以响应浏览器
13+
$(window).on('resize', () => {
1414
helpers.resizeMemos();
1515
});

src/storage/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class VueMemoStore {
113113

114114
let m5 = new Memo({
115115
categoryId: 1,
116-
title: '5. Westworld - Quote',
116+
title: '6. Westworld - Quote',
117117
type: 0,
118118
content: `> By most mechanical and dirty hand,\n\n> I shall have such revenges on you both.\n\n> The things I will do,\n\n> what they are yet I know not,\n\n> but they will be the terrors of the earth.`,
119119
});
@@ -122,7 +122,7 @@ class VueMemoStore {
122122

123123
let m6 = new Memo({
124124
categoryId: 2,
125-
title: '6. 凛冬的寒风快点出版啊!!',
125+
title: '5. 凛冬的寒风快点出版啊!!',
126126
type: 1,
127127
});
128128
m6.timeStamp = toReadableDate(new Date(Date.parse('Oct 5, 2016')));

src/style/main.styl

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,14 @@ blockquote
6666
-webkit-user-select none
6767

6868
.navbar-right
69-
padding-right 0
7069

7170
a
72-
cursor pointer !important
73-
line-height 24px !important
74-
75-
.navbar-form
76-
padding-right 0
71+
cursor pointer
7772

7873
.search-box
74+
width calc(100% - 24px)
7975
min-width 180px
76+
margin 6px 12px
8077

8178
.dropdown-toggle
8279
position relative
@@ -87,17 +84,17 @@ blockquote
8784
background rgb(231, 231, 231) !important
8885

8986
&:after
90-
content ' '
87+
position absolute
9188
width 24px
9289
height 24px
93-
background url("/src/images/icons/icon-dropdown.png") 0 0 no-repeat
94-
position absolute
90+
top 8px
9591
right 18px
92+
background url("/src/images/icons/icon-dropdown.png") 0 0 no-repeat
93+
content ' '
9694
opacity .6
97-
top 8px
9895

9996
@media (min-width 768px)
100-
top 15px
97+
top 13px
10198

10299
.count
103100
border-radius 5px
@@ -113,15 +110,12 @@ blockquote
113110

114111
#memos
115112
min-height 800px
116-
padding 0 6px
117-
118-
#memos-wrapper
119-
margin 0 auto
113+
margin-top 6px
114+
padding 0
120115

121116
.memo-container
122-
padding 5px
117+
padding 6px
123118
float left
124-
margin-top 10px
125119

126120
.memo
127121
position relative
@@ -132,18 +126,17 @@ blockquote
132126
transition all .15s ease-in-out
133127

134128
&:hover
135-
box-shadow 0 0 10px 0 $dark-grey
129+
box-shadow 0 0 6px 0 $dark-grey
136130

137131
.mark
138132
display block
139133

140134
&[data-completed=true]
141-
border-color $dark-blue
135+
border-color $tint-blue
142136

143137
.mark
144138
display block
145139

146-
147140
.mark
148141
display none
149142
position absolute
@@ -160,8 +153,6 @@ blockquote
160153
&:hover
161154
transform scale(1.2)
162155

163-
164-
165156
.memo-heading
166157
position relative
167158
width 100%
@@ -353,7 +344,7 @@ blockquote
353344

354345
&:hover,
355346
&.current
356-
box-shadow 0 0 4px $bootstrap-black
347+
box-shadow 0 0 6px $bootstrap-black
357348
&[data-color=green]
358349
background-color $bootstrap-green
359350
&[data-color=yellow]
@@ -373,12 +364,14 @@ blockquote
373364

374365
@media (max-width 768px)
375366

367+
#memos
368+
padding 0 5px
369+
376370
.memo-container
371+
padding 2px
372+
margin-top 0
377373
width 50%
378374

379-
.search-box
380-
text-indent 18px
381-
382375
@media (min-width 768px) and (max-width 992px)
383376
.memo-container
384377
width 33.3%

0 commit comments

Comments
 (0)