an annoying website with Vue

This commit is contained in:
theo1 2021-02-06 17:32:21 +01:00
parent fc39713ca4
commit 5abb8fc6c7
4 changed files with 66 additions and 63 deletions

20
index.html Executable file
View File

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="test.css">
<title> Responsive ? </title>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"
preserveAspectRatio="none">
<polygon class="svg--lg" fill="white"
points="0,0 15,100 33,21 45,100 50,75 55,100 72,20 85,100 95,50 100,80 100,100 0,100" />
</svg>
<!-- Header bar -->
<section id="section1">
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Nisi itaque natus soluta incidunt quidem rerum dolorem id ipsam reiciendis, odio, porro et recusandae quia repellendus cum praesentium suscipit eos debitis.</p>
</section>
</body>
</html>

View File

@ -8,6 +8,14 @@
<title><%= htmlWebpackPlugin.options.title %></title> <title><%= htmlWebpackPlugin.options.title %></title>
</head> </head>
<body> <body>
<div id='svg-container' viewBox="0 0 1010 666">
<svg id='svg-el'>
<polyline id='svg-el-polyline' points=""
style="fill:none;stroke:black;stroke-width:1" />
</svg>
</div>
<noscript> <noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>

View File

@ -1,17 +1,39 @@
<template> <template>
<div id="app"> <div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div> </div>
</template> </template>
<script> <script>
import HelloWorld from './components/HelloWorld.vue'
export default { export default {
name: 'App', name: 'App',
components: { components: {
HelloWorld },
data() {
return {
xpos: 0,
ypos: 0,
nodes: []
}
},
computed: {
},
methods: {
updateMousePos(event) {
this.xpos = event.clientX
this.ypos = event.clientY
},
addNode(event) {
let eventX = event.clientX
let eventY = event.clientY
this.nodes.push({ x: eventX, y:eventY})
let svg_el = document.getElementById('svg-el-polyline')
let points = svg_el.getAttribute('points') + ' ' + eventX + ',' + eventY
document.getElementById('svg-el-polyline').setAttribute('points', points)
}
},
created() {
document.onmousemove = this.updateMousePos
document.onmouseup = this.addNode
} }
} }
</script> </script>
@ -25,4 +47,15 @@ export default {
color: #2c3e50; color: #2c3e50;
margin-top: 60px; margin-top: 60px;
} }
#svg-container, #svg-el {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style> </style>

View File

@ -1,58 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>