85 lines
1.9 KiB
HTML
85 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="pl">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Lekcja 3</title>
|
|
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="app">
|
|
<div @click="divclick">click</div>
|
|
|
|
<hr>
|
|
|
|
<select @change="schange">
|
|
<option>opt1</option>
|
|
<option>opt2</option>
|
|
<option>opt3</option>
|
|
<option>opt4</option>
|
|
<option>opt5</option>
|
|
<option>opt6</option>
|
|
</select>
|
|
<p v-text="select_value"></p>
|
|
|
|
<hr>
|
|
|
|
<input type="range" @change="rchange" value="50" min="0" max="100" step="1">
|
|
<p v-text="range_value"></p>
|
|
|
|
<hr>
|
|
|
|
<input type="checkbox" @change="cchange">
|
|
<p v-text="checkbox_value"></p>
|
|
|
|
<hr>
|
|
|
|
<button @click="icounter">powiększ licznik</button>
|
|
<p v-text="counter"></p>
|
|
|
|
<hr>
|
|
|
|
<button @click="cpower">potęguj 2 do licznika</button>
|
|
<p v-text="power"></p>
|
|
</div>
|
|
</body>
|
|
|
|
<script>
|
|
const app = Vue.createApp({
|
|
data() {
|
|
return {
|
|
select_value: 'opt1',
|
|
range_value: 50,
|
|
checkbox_value: false,
|
|
counter: 0,
|
|
power: 0
|
|
}
|
|
},
|
|
methods: {
|
|
divclick() {
|
|
alert("KLIK");
|
|
},
|
|
schange(e) {
|
|
app.select_value = e.target.value;
|
|
},
|
|
rchange(e) {
|
|
app.range_value = e.target.value;
|
|
},
|
|
cchange(e) {
|
|
app.checkbox_value = !app.checkbox_value;
|
|
alert(app.checkbox_value);
|
|
},
|
|
icounter() {
|
|
app.counter++;
|
|
},
|
|
cpower() {
|
|
app.power = 2 ** app.counter;
|
|
}
|
|
}
|
|
}).mount("#app");
|
|
|
|
</script>
|
|
|
|
</html> |