-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog.vue
198 lines (195 loc) · 4.53 KB
/
blog.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
<template>
<baseComponent id="1" pk="blog" :windowstyle="windowstyle" @scroll="scroll">
<template #title>BLOG</template>
<template #next_page>
<slot
name="next_page"
@scroll="scroll"
@heightChange="heightChange"
@widthChange="widthChange"
/>
</template>
<template #text>
<div class="overflow-hidden">
<div
class="
grid
lg:grid-cols-3
grid-cols-1
lg:grid-rows-2
w-full
articles
lg:p-4 lg:pb-2
pb-3
"
>
<articlePreview
v-for="article in articles"
:key="article.slug"
:article="article"
/>
</div>
<nuxt-link
to="/blog"
class="
text-base text-white
h-1/6
border border-white
font-light
px-2
py-1
mb-2
mr-6
float-right
more
"
>
mehr Artikel
</nuxt-link>
</div>
</template>
<template #content>
<!-- <div id="canvas"></div> :style="{ height: height + 'px', width: width + 'px' }"
-->
<!-- <canvas id="canvas" :height="height" :width="width"></canvas> -->
</template>
</baseComponent>
</template>
<script>
import baseComponent from '@/components/baseComponent.vue'
// import P5 from 'p5'
export default {
components: {
baseComponent,
},
props: {
articles: {
type: Array,
default() {
return []
},
},
windowstyle: {
type: Object,
default() {
return {}
},
},
},
data() {
return {
height: 0,
width: 0,
}
},
mounted() {
// const canvas = document.getElementById('canvas')
// const ctx = canvas.getContext('2d')
// ctx.fillStyle = 'green'
// // ctx.fillRect(10, 10, 150, 100)
// const collatz = (n) => {
// return n % 2 === 0 ? n / 2 : (n * 3 + 1) / 2
// }
// for (let i = 1; i < 1000; i++) {
// const sequence = []
// let n = i
// do {
// sequence.push(n)
// n = collatz(n)
// } while (n !== 1)
// sequence.push(1)
// sequence.reverse()
// const len = 5
// let angle = 0.2
// let x = canvas.height / 2
// let y = canvas.height / 2
// ctx.beginPath()
// ctx.lineWidth = 1
// ctx.moveTo(x, y)
// for (let j = 0; j < sequence.length; j++) {
// const value = sequence[j]
// if (value % 2 === 0) {
// x -= len * Math.sin(angle)
// y -= len * Math.cos(angle)
// angle++
// } else {
// x -= len * Math.sin(-angle)
// y -= len * Math.cos(-angle)
// angle--
// }
// ctx.lineTo(x, y)
// ctx.stroke()
// }
// }
//
//
//
//
// const script = (p5) => {
// p5.setup = () => {
// p5.createCanvas(this.height / 1.618, this.height / 1.618)
// const collatz = (n) => {
// return n % 2 === 0 ? n / 2 : (n * 3 + 1) / 2
// }
// for (let i = 1; i < 10000; i++) {
// const sequence = []
// let n = i
// do {
// sequence.push(n)
// n = collatz(n)
// } while (n !== 1)
// sequence.push(1)
// sequence.reverse()
// const len = 5
// const angle = 0.15
// p5.resetMatrix()
// p5.translate(0, p5.height)
// for (let j = 0; j < sequence.length; j++) {
// const value = sequence[j]
// value % 2 === 0 ? p5.rotate(angle) : p5.rotate(-angle)
// p5.strokeWeight(2)
// p5.stroke(255, 10)
// p5.line(0, 0, 0, -len)
// p5.translate(0, -len)
// }
// }
// }
// p5.draw = () => {
// // p5.clear()
// // p5.ellipse(p5.mouseX, p5.mouseY, 40, 40)
// }
// }
// // eslint-disable-next-line no-unused-vars
// const p5canvas = new P5(script, 'canvas')
},
methods: {
heightChange(e) {
this.height = e
},
scroll(e) {
this.$emit('scroll', e)
},
widthChange(e) {
this.width = e
},
articleLink(slug) {
return '/blog/' + slug
},
},
}
</script>
<style scoped>
.word-wrap {
word-wrap: break-word;
word-break: break-all;
}
.more {
transition: all 200ms ease;
}
.more:hover {
transform: scale(1.1);
}
#canvas {
transform: scale(0.618);
}
</style>