This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
function in javascript is object and we can store what ever inside | |
*/ | |
function x() | |
{ | |
console.log('im x') | |
} | |
x.$version = '1.3.21' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div> | |
<h1>Async Component Example</h1> | |
<suspense> | |
<template #default> | |
<AsyncComponent /> | |
</template> | |
<template #fallback> | |
<LoadingSpinner /> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- MouseTracker.vue --> | |
<script setup> | |
import { ref, onMounted, onUnmounted } from 'vue' | |
const x = ref(0) | |
const y = ref(0) | |
const update = e => { | |
x.value = e.pageX | |
y.value = e.pageY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- https://www.patterns.dev/vue/data-provider --> | |
<!-- Provider.vue --> | |
<template> | |
<slot :data="data" :loading="loading"></slot> | |
</template> | |
<script setup> | |
import { ref, reactive } from "vue"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { openBlock as r, createElementBlock as l, toDisplayString as s, defineCustomElement as i } from "https://cdn.jsdelivr.net/npm/vue@3.4.27/dist/vue.runtime.esm-browser.prod.js"; | |
const c = "h1[data-v-883a1ab3]{font-weight:500;font-size:2.6rem;position:relative;top:-10px}h3[data-v-883a1ab3]{font-size:1.2rem}.greetings h1[data-v-883a1ab3],.greetings h3[data-v-883a1ab3]{text-align:center}@media (min-width: 1024px){.greetings h1[data-v-883a1ab3],.greetings h3[data-v-883a1ab3]{text-align:left}}", d = (e, a) => { | |
const t = e.__vccOpts || e; | |
for (const [o, n] of a) | |
t[o] = n; | |
return t; | |
}, g = { | |
__name: "HelloWorld.ce", | |
props: { | |
msg: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://towardsdev.com/sql-case-statement-with-code-examples-04f77dab8d5a | |
-- 1. Simple case | |
SELECT | |
order_id, | |
CASE customer_id | |
WHEN 1 THEN 'Premium' | |
WHEN 2 THEN 'Gold' | |
WHEN 3 THEN 'Silver' | |
ELSE 'Regular' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Composable | |
const useBurger = () => { | |
const lettuce = ref(true); | |
const ketchup = ref(true); | |
return { | |
lettuce, | |
ketchup, | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Destructure into multiple variables | |
const obj = { val: 1 }; | |
const { val: a, val: b, val } = obj; | |
console.log(a); // -> 1 | |
console.log(b); // -> 1 | |
console.log(val); // -> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- component definition --> | |
{define badge, bool $show = true, string $title = '', $class = null} | |
<span class="badge ms-2 font-size-small {$class ?? 'bg-body-secondary text-body'}" n:if="$show" title="{$title}"> | |
{block content}{/block} | |
</span> | |
{/define} | |
<!-- usage --> | |
{embed badge, $client !== null, 'Uhrazeno'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<h1>test</h1> | |
<component :is="dynamicComponent" /> | |
</template> | |
<script setup> | |
import { computed} from 'vue' | |
const dynamicComponent = computed(() => { |
NewerOlder