VueJS lekcja 3
This commit is contained in:
1 parent
0a308d6145
commit
58990da7c8
6 files changed
+434
No files matched your search
@@ -0,0 +1,38 @@
|
||||
<!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">
|
||||
<h2>v-show</h2>
|
||||
<button v-text="label" @click="toggle_show"></button>
|
||||
<div v-show="show">element</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
<script>
|
||||
|
||||
const app = Vue.createApp({
|
||||
data() {
|
||||
return {
|
||||
show: true,
|
||||
label: "ukryj"
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggle_show() {
|
||||
app.show = !app.show;
|
||||
app.show ? app.label = "ukryj" : app.label = "pokaż";
|
||||
}
|
||||
}
|
||||
}).mount("#app");
|
||||
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user