963 markdown files reformatted with the repository's pinned prettier so pnpm format:check covers the folded tree like every other repo file. The formatter's embedded-language pass also normalized code fences (TS semicolons, closed HTML tags in examples, lowercased CSS hex colors, one renumbered list that skipped an index). Alphanumeric token deltas vs the fold commit were audited file-by-file; all are formatter-equivalent markup normalizations plus the four sanitized skills.
1.1 KiB
1.1 KiB
category
| category |
|---|
| Sensors |
onElementRemoval
Fires when the element or any element containing it is removed.
Usage
<script setup lang="ts">
import { onElementRemoval } from '@vueuse/core';
import { shallowRef, useTemplateRef } from 'vue';
const btnRef = useTemplateRef('btn');
const btnState = shallowRef(true);
const removedCount = shallowRef(0);
function btnOnClick() {
btnState.value = !btnState.value;
}
onElementRemoval(btnRef, () => ++removedCount.value);
</script>
<template>
<button v-if="btnState" @click="btnOnClick">recreate me</button>
<button v-else ref="btnRef" @click="btnOnClick">remove me</button>
<b>removed times: {{ removedCount }}</b>
</template>
Type Declarations
export interface OnElementRemovalOptions
extends ConfigurableWindow, ConfigurableDocumentOrShadowRoot, WatchOptionsBase {}
/**
* Fires when the element or any element containing it is removed.
*
* @param target
* @param callback
* @param options
*/
export declare function onElementRemoval(
target: MaybeElementRef,
callback: (mutationRecords: MutationRecord[]) => void,
options?: OnElementRemovalOptions,
): Fn;