Skip to content

Instantly share code, notes, and snippets.

/* for example get el width */
// template
<p ref="appTitleRef">App title</p>
// script
const appTitleRef = ref(null)
onMounted(() => {
console.log(`The app title is ${ appTitleRef.value.offsetWidth } px wide`)
// script
const posts = ref([
{
id: 1,
title: 'post 1'
},
{
id: 2,
title: 'post 2'
}
/*
Computed properties are properties which are usually generated based on reactive data which are cached and only update when dependencies change.
*/
<template>
<p>{{ data.number }}</p>
<p>This number is {{ oddOrEven }}</p>
<button @click="newNumber(5)">Set the number<button/>
</template>
<template>
<h1>{{ title }}</h1>
<p>Edit title: </p>
<input v-model="title" type="text"/>
</template>
<script setup>
import { ref } from 'vue'
@ABooooo
ABooooo / Refs
Last active June 19, 2024 11:46
<template>
<p>{{ text }}</p>
</template>
<script setup>
import { ref } from 'vue'
const text = ref('juhu')
</script>
$('#saveNewTasklist').on("click", function () {
const nestedQuery = '.nested-sortable';
const identifier = 'taskId';
const root = document.getElementById('tasks');
function serialize(tasks) {
var serialized = [];
var children = [].slice.call(tasks.children); // children == document property
/**
* [].slice.call() == Array.prototype.slice.call()
*
var overviewPageUrl = '@Model.Content.Url';
var overviewPageUrl = '@Model.Content.Parent.Url';
var detailPageUrl = '@Model.Content.Children.SingleOrDefault(node => node.DocumentTypeAlias == "MDArticleLocalDetailPage").Url';
// place in template
do_action( 'tuttner_show_payment_options' );
// place in functions.php
add_action( 'tuttner_show_payment_options', 'woocommerce_checkout_payment', 20 );
// this example is for custom placing a payment options
<?php
$args = array(
'post_type' => 'product',
'product_cat' => 'klaviere',
'posts_per_page' => 3,
'orderby' => 'date',
'order' => 'DESC'
);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post();
// model
// ts
export interface Post {
// some data for example
title: string;
content: string;
}
// service
// ts