VueJS Lekcja 2

This commit is contained in:
aplikacje committed 2026-10-26 14:34:03 +01:00
1 parent e66b5ebc22
commit 0a308d6145
10 files changed
+373 -2

No files matched your search

@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Start VueJS</title>
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="app">
<p>tekst: {{ text }}</p>
<p>length: {{ length }}</p>
<h2>długość tekstu: {{ getTextLength2() }}</h2>
<h2>długość tekstu: {{ getTextLength(text) }}</h2>
<h2 v-text="getTextLength(text)"></h2>
<h2 v-html="getTextLengthWithHTML()"></h2>
</div>
</body>
<script>
const app = Vue.createApp({
data() {
return {
text: "to jest tekst",
length: 0
}
},
methods: {
getTextLength(val) {
return val.length
},
getTextLength2() {
return this.text.length
},
getTextLengthWithHTML() {
return "długość text: " + this.text.length
},
setLength(val) {
this.length = val
}
}
}).mount("#app");
</script>
</html>