Skip to content

Commit

Permalink
Change Vue 2 and Vue 3 examples to compact mode (#190)
Browse files Browse the repository at this point in the history
This makes the code more comparable to Svelte, React, Alpine, etc.
  • Loading branch information
waldyrious committed Sep 22, 2023
1 parent 49dca5b commit ffc3901
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 48 deletions.
8 changes: 2 additions & 6 deletions content/2-templating/2-styling/vue2/CssStyle.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<template>
<div>
<h1 class="title">
I am red
</h1>
<button style="font-size: 10rem">
I am a button
</button>
<h1 class="title">I am red</h1>
<button style="font-size: 10rem">I am a button</button>
</div>
</template>

Expand Down
8 changes: 2 additions & 6 deletions content/2-templating/2-styling/vue3/CssStyle.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<template>
<h1 class="title">
I am red
</h1>
<button style="font-size: 10rem">
I am a button
</button>
<h1 class="title">I am red</h1>
<button style="font-size: 10rem">I am a button</button>
</template>

<style scoped>
Expand Down
4 changes: 1 addition & 3 deletions content/2-templating/4-event-click/vue2/Counter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ export default {
<template>
<div>
<p>Counter: {{ count }}</p>
<button @click="incrementCount">
+1
</button>
<button @click="incrementCount">+1</button>
</div>
</template>
4 changes: 1 addition & 3 deletions content/2-templating/4-event-click/vue3/Counter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ function incrementCount() {

<template>
<p>Counter: {{ count }}</p>
<button @click="incrementCount">
+1
</button>
<button @click="incrementCount">+1</button>
</template>
4 changes: 1 addition & 3 deletions content/2-templating/6-conditional/vue2/TrafficLight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ export default {

<template>
<div>
<button @click="nextLight">
Next light
</button>
<button @click="nextLight">Next light</button>
<p>Light is: {{ light }}</p>
<p>
You must
Expand Down
4 changes: 1 addition & 3 deletions content/2-templating/6-conditional/vue3/TrafficLight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ function nextLight() {
</script>

<template>
<button @click="nextLight">
Next light
</button>
<button @click="nextLight">Next light</button>
<p>Light is: {{ light }}</p>
<p>
You must
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ export default {

<template>
<div>
<button @click="clickYes">
YES
</button>
<button @click="clickYes">YES</button>

<button @click="clickNo">
NO
</button>
<button @click="clickNo">NO</button>
</div>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ function clickNo() {
</script>

<template>
<button @click="clickYes">
YES
</button>
<button @click="clickYes">YES</button>

<button @click="clickNo">
NO
</button>
<button @click="clickNo">NO</button>
</template>
8 changes: 2 additions & 6 deletions content/7-webapp-features/2-fetch-data/vue2/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@ export default {
</script>

<template>
<p v-if="isLoading">
Fetching users...
</p>
<p v-else-if="error">
An error ocurred while fetching users
</p>
<p v-if="isLoading">Fetching users...</p>
<p v-else-if="error">An error ocurred while fetching users</p>
<ul v-else-if="users">
<li
v-for="user in users"
Expand Down
8 changes: 2 additions & 6 deletions content/7-webapp-features/2-fetch-data/vue3/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ const { isLoading, error, data: users } = useFetchUsers();
</script>

<template>
<p v-if="isLoading">
Fetching users...
</p>
<p v-else-if="error">
An error ocurred while fetching users
</p>
<p v-if="isLoading">Fetching users...</p>
<p v-else-if="error">An error ocurred while fetching users</p>
<ul v-else-if="users">
<li
v-for="user in users"
Expand Down
2 changes: 2 additions & 0 deletions frameworks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default [
extends: ["eslint:recommended", "plugin:vue/vue3-recommended"],
rules: {
"vue/multi-word-component-names": "off",
"vue/singleline-html-element-content-newline": "off",
},
},
playgroundURL: "https://sfc.vuejs.org",
Expand Down Expand Up @@ -154,6 +155,7 @@ export default [
extends: ["eslint:recommended", "plugin:vue/recommended"],
rules: {
"vue/multi-word-component-names": "off",
"vue/singleline-html-element-content-newline": "off",
},
},
playgroundURL: "",
Expand Down

0 comments on commit ffc3901

Please sign in to comment.