Skip to content

Commit

Permalink
Add custom functions
Browse files Browse the repository at this point in the history
  • Loading branch information
arwinvdv committed May 9, 2023
1 parent f0dbfec commit 18c6cb8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
10 changes: 10 additions & 0 deletions src/components/mixins/mixin1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export default {
methods: {
customFunctionThatIsNotMinified(variable) {
if (variable) {
return 'test';
}
return 'test2';
},
},
};
42 changes: 34 additions & 8 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,41 @@
<script setup>
import { onMounted } from 'vue';
<script>
import { } from 'vue';
import { currentTheme, initTheme, switchTheme } from '@/composables/theme.js';
import mixin1 from '@/components/mixins/mixin1';
export default {
mixins: [mixin1],
data() {
return {
testMessage: 0,
currentTheme,
switchTheme,
};
},
computed: {
myVal() {
return this.customFunctionThatIsNotMinified(true);
},
},
mounted() {
initTheme();
},
methods: {
anotherCustomFunctionThatIsNotMinified() {
return 'test';
},
},
};
onMounted(() => {
initTheme();
});
</script>

<template>
<header class="absolute inset-x-0 top-0">
<div class="container mx-auto flex justify-end p-4">
{{ testMessage }}
{{ myVal }}
{{ anotherCustomFunctionThatIsNotMinified() }}

<button
class="overflow-hidden p-2"
@click="switchTheme()"
Expand Down Expand Up @@ -55,7 +81,7 @@ onMounted(() => {
</div>
</header>

<main class="mx-auto flex h-screen max-w-3xl flex-col items-center justify-center py-16 px-4">
<main class="mx-auto flex h-screen max-w-3xl flex-col items-center justify-center px-4 py-16">
<h1 class="pb-20 text-center text-6xl text-gray-700 transition-colors dark:text-gray-100">
Vue.js starter template
</h1>
Expand All @@ -65,7 +91,7 @@ onMounted(() => {
target="_blank"
rel="noopener"
href="https://open.vscode.dev/lecoueyl/vue3-template"
class="inline-flex items-center space-x-1 rounded-md bg-indigo-600 py-4 px-6 font-medium text-indigo-50 shadow-xl transition duration-300 hover:bg-indigo-700 hover:shadow-md"
class="inline-flex items-center space-x-1 rounded-md bg-indigo-600 px-6 py-4 font-medium text-indigo-50 shadow-xl transition duration-300 hover:bg-indigo-700 hover:shadow-md"
>
<svg
viewBox="0 0 24 24"
Expand All @@ -83,7 +109,7 @@ onMounted(() => {
target="_blank"
rel="noopener"
href="https://github.com/lecoueyl/vue3-template"
class="inline-flex items-center space-x-1 rounded-md bg-indigo-600 py-4 px-6 font-medium text-indigo-50 shadow-xl transition duration-300 hover:bg-indigo-700 hover:shadow-md"
class="inline-flex items-center space-x-1 rounded-md bg-indigo-600 px-6 py-4 font-medium text-indigo-50 shadow-xl transition duration-300 hover:bg-indigo-700 hover:shadow-md"
>
<svg
viewBox="0 0 24 24"
Expand Down

0 comments on commit 18c6cb8

Please sign in to comment.