本篇示例专用于展示与测试博客正文中的 多标签页切换(Interactive Tabs)与多版本下拉切换器(Dropdown Switcher) 。
一、包管理器安装命令选项卡(Interactive Tabs)
用户可以点击不同的标签页快速复制对应包管理器的安装指令:
pnpm (推荐)
npm
yarn
bun
pnpm add @astrojs/mdx remark-math rehype-katex katex mermaid
npm install @astrojs/mdx remark-math rehype-katex katex mermaid
yarn add @astrojs/mdx remark-math rehype-katex katex mermaid
bun add @astrojs/mdx remark-math rehype-katex katex mermaid
< div class = "article-tabs" >
< div class = "article-tabs__nav" >
< button class = "article-tabs__button is-active" type = "button" >pnpm</ button >
< button class = "article-tabs__button" type = "button" >npm</ button >
</ div >
< div class = "article-tabs__panels" >
< div class = "article-tabs__panel is-active" >
< pre >< code >pnpm add ...</ code ></ pre >
</ div >
< div class = "article-tabs__panel" >
< pre >< code >npm install ...</ code ></ pre >
</ div >
</ div >
</ div >
二、多前端框架实现下拉切换器(Interactive Dropdown Switcher)
通过正文内的下拉菜单选择目标技术框架,下方的内容面板将自动同步切换:
⚛️ React 19 (Hooks)
🟢 Vue 3.5 (Composition API)
🚀 Astro 6 (Islands)
🟠 Svelte 5 (Runes)
⚛️ React 19 计数器代码:
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount((c) => c + 1)}>Count: {count}</button>;
}
🟢 Vue 3.5 计数器代码:
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
</script>
<template>
<button @click="count++">Count: {{ count }}</button>
</template>
🚀 Astro 6 群岛组件代码:
---
const { label = "Astro 静态组件" } = Astro.props;
---
<div class="astro-card">
<h3>{label}</h3>
</div>
🟠 Svelte 5 计数器代码:
<script lang="ts">
let count = $state(0);
</script>
<button onclick={() => count++}>Count: {count}</button>
Dieses Beispiel dient ausschließlich dazu, die Mehrfach-Tab-Umschaltung (Interactive Tabs) und die Mehrversions-Dropdown-Umschaltung (Dropdown Switcher) im Blog-Text zu demonstrieren und zu testen.
1. Paketmanager-Installationsbefehle-Tab (Interactive Tabs)
Der Benutzer kann durch Klicken auf verschiedene Tabs die entsprechenden Paketmanager-Installationsbefehle schnell kopieren:
pnpm (empfohlen)
npm
yarn
bun
pnpm add @astrojs/mdx remark-math rehype-katex katex mermaid
npm install @astrojs/mdx remark-math rehype-katex katex mermaid
yarn add @astrojs/mdx remark-math rehype-katex katex mermaid
bun add @astrojs/mdx remark-math rehype-katex katex mermaid
< div class = "article-tabs" >
< div class = "article-tabs__nav" >
< button class = "article-tabs__button is-active" type = "button" >pnpm</ button >
< button class = "article-tabs__button" type = "button" >npm</ button >
</ div >
< div class = "article-tabs__panels" >
< div class = "article-tabs__panel is-active" >
< pre >< code >pnpm add ...</ code ></ pre >
</ div >
< div class = "article-tabs__panel" >
< pre >< code >npm install ...</ code ></ pre >
</ div >
</ div >
</ div >
2. Mehrere Frontend-Framework-Implementierungen für Dropdown-Umschalter (Interactive Dropdown Switcher)
Durch Auswahl des Ziel-Frameworks im Dropdown-Menü im Text wird die darunterliegende Inhaltsanzeige automatisch synchronisiert:
Wählen Sie die Frontend-Framework-Implementierung:
⚛️ React 19 (Hooks)
🟢 Vue 3.5 (Composition API)
🚀 Astro 6 (Islands)
🟠 Svelte 5 (Runes)
⚛️ React 19 Zähler-Code:
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return setCount((c) => c + 1)}>Count: {count} ;
}
🟢 Vue 3.5 Zähler-Code:
Zähler: {{ count }}
🚀 Astro 6 Insel-Komponenten-Code:
---
const { label = "Astro statische Komponente" } = Astro.props;
---
{{label}}
🟠 Svelte 5 Zähler-Code:
count++>Zähler: {count}
This example is dedicated to demonstrating and testing Interactive Tabs and Dropdown Switchers within blog post bodies.
1. Package Manager Installation Command Tabs (Interactive Tabs)
Users can click on different tabs to quickly copy the installation commands for the corresponding package manager:
pnpm (Recommended)
npm
yarn
bun
pnpm add @astrojs/mdx remark-math rehype-katex katex mermaid
npm install @astrojs/mdx remark-math rehype-katex katex mermaid
yarn add @astrojs/mdx remark-math rehype-katex katex mermaid
bun add @astrojs/mdx remark-math rehype-katex katex mermaid
< div class = "article-tabs" >
< div class = "article-tabs__nav" >
< button class = "article-tabs__button is-active" type = "button" >pnpm</ button >
< button class = "article-tabs__button" type = "button" >npm</ button >
</ div >
< div class = "article-tabs__panels" >
< div class = "article-tabs__panel is-active" >
< pre >< code >pnpm add ...</ code ></ pre >
</ div >
< div class = "article-tabs__panel" >
< pre >< code >npm install ...</ code ></ pre >
</ div >
</ div >
</ div >
II. Implementing an Interactive Dropdown Switcher Across Multiple Frontend Frameworks
Select a target technology framework from the dropdown menu in the body text, and the content panel below will automatically switch in sync:
Select frontend framework implementation:
⚛️ React 19 (Hooks)
🟢 Vue 3.5 (Composition API)
🚀 Astro 6 (Islands)
🟠 Svelte 5 (Runes)
⚛️ React 19 Counter Code:
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount((c) => c + 1)}>Count: {count}</button>;
}
🟢 Vue 3.5 Counter Code:
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
</script>
<template>
<button @click="count++">Count: {{ count }}</button>
</template>
🚀 Astro 6 Island Component Code:
---
const { label = "Astro Static Component" } = Astro.props;
---
<div class="astro-card">
<h3>{label}</h3>
</div>
🟠 Svelte 5 Counter Code:
<script lang="ts">
let count = $state(0);
</script>
<button onclick={() => count++}>Count: {count}</button>
Este ejemplo está diseñado específicamente para demostrar y probar las pestañas interactivas (Interactive Tabs) y el selector desplegable de múltiples versiones (Dropdown Switcher) en el cuerpo del artículo del blog.
1. Pestañas de comandos de instalación de gestores de paquetes (Interactive Tabs)
Los usuarios pueden hacer clic en diferentes pestañas para copiar rápidamente el comando de instalación correspondiente a cada gestor de paquetes:
pnpm (recomendado)
npm
yarn
bun
pnpm add @astrojs/mdx remark-math rehype-katex katex mermaid
npm install @astrojs/mdx remark-math rehype-katex katex mermaid
yarn add @astrojs/mdx remark-math rehype-katex katex mermaid
bun add @astrojs/mdx remark-math rehype-katex katex mermaid
< div class = "article-tabs" >
< div class = "article-tabs__nav" >
< button class = "article-tabs__button is-active" type = "button" >pnpm</ button >
< button class = "article-tabs__button" type = "button" >npm</ button >
</ div >
< div class = "article-tabs__panels" >
< div class = "article-tabs__panel is-active" >
< pre >< code >pnpm add ...</ code ></ pre >
</ div >
< div class = "article-tabs__panel" >
< pre >< code >npm install ...</ code ></ pre >
</ div >
</ div >
</ div >
2. Implementación de un Selector Desplegable con Múltiples Frameworks Frontend (Interactive Dropdown Switcher)
Seleccione el framework tecnológico deseado a través del menú desplegable en el cuerpo del texto, y el panel de contenido inferior cambiará automáticamente de forma sincronizada:
Seleccionar implementación del framework frontend:
⚛️ React 19 (Hooks)
🟢 Vue 3.5 (Composition API)
🚀 Astro 6 (Islands)
🟠 Svelte 5 (Runes)
⚛️ Código del contador de React 19:
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount((c) => c + 1)}>Count: {count}</button>;
}
🟢 Código del contador de Vue 3.5:
<script setup lang="ts">
import { ref } from 'vue';
const count = ref(0);
</script>
<template>
<button @click="count++">Count: {{ count }}</button>
</template>
🚀 Código del componente de islas de Astro 6:
---
const { label = "Astro 静态组件" } = Astro.props;
---
<div class="astro-card">
<h3>{label}</h3>
</div>
🟠 Código del contador de Svelte 5:
<script lang="ts">
let count = $state(0);
</script>
<button onclick={() => count++}>Count: {count}</button>
Cet exemple est dédié à la démonstration et aux tests des onglets interactifs (Interactive Tabs) et du sélecteur déroulant multi-version (Dropdown Switcher) dans le corps du blog.
1. Onglets d’installation des gestionnaires de paquets (Interactive Tabs)
L’utilisateur peut cliquer sur différents onglets pour copier rapidement les commandes d’installation correspondantes du gestionnaire de paquets :
pnpm (recommandé)
npm
yarn
bun
pnpm add @astrojs/mdx remark-math rehype-katex katex mermaid
npm install @astrojs/mdx remark-math rehype-katex katex mermaid
yarn add @astrojs/mdx remark-math rehype-katex katex mermaid
bun add @astrojs/mdx remark-math rehype-katex katex mermaid
< div class = "article-tabs" >
< div class = "article-tabs__nav" >
< button class = "article-tabs__button is-active" type = "button" >pnpm</ button >
< button class = "article-tabs__button" type = "button" >npm</ button >
</ div >
< div class = "article-tabs__panels" >
< div class = "article-tabs__panel is-active" >
< pre >< code >pnpm add ...</ code ></ pre >
</ div >
< div class = "article-tabs__panel" >
< pre >< code >npm install ...</ code ></ pre >
</ div >
</ div >
</ div >
2. Sélecteur déroulant multi-frontend (Interactive Dropdown Switcher)
En sélectionnant le cadre technologique cible via le menu déroulant dans le corps du texte, le panneau de contenu ci-dessous basculera automatiquement :
Choisir la mise en œuvre du cadre frontend :
⚛️ React 19 (Hooks)
🟢 Vue 3.5 (Composition API)
🚀 Astro 6 (Islands)
🟠 Svelte 5 (Runes)
⚛️ React 19 Code du compteur :
import { useState } from 'react';
export function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount((c) => c + 1)}>Count: {count}</button>;
}
🟢 Vue 3.5 code du compteur:
Compteur: {{ count }}
🚀 Astro 6 code du composant île:
---
const { label = "Astro composant statique" } = Astro.props;
---
{label}
🟠 Svelte 5 code du compteur:
count++>Compteur: {count}
本篇範例專用於展示與測試部落格正文中的 多標籤頁切換(Interactive Tabs)與多版本下拉切換器(Dropdown Switcher) 。
一、包管理器安裝命令選項卡(Interactive Tabs)
使用者可以點擊不同的標籤頁快速複製對應包管理器的安裝指令:
pnpm (推薦)
npm
yarn
bun
pnpm add @astrojs/mdx remark-math rehype-katex katex mermaid
npm install @astrojs/mdx remark-math rehype-katex katex mermaid
yarn add @astrojs/mdx remark-math rehype-katex katex mermaid
bun add @astrojs/mdx remark-math rehype-katex katex mermaid
< div class = "article-tabs" >
< div class = "article-tabs__nav" >
< button class = "article-tabs__button is-active" type = "button" >pnpm</ button >
< button class = "article-tabs__button" type = "button" >npm</ button >
</ div >
< div class = "article-tabs__panels" >
< div class = "article-tabs__panel is-active" >
< pre >< code >pnpm add ...</ code ></ pre >
</ div >
< div class = "article-tabs__panel" >
< pre >< code >npm install ...</ code ></ pre >
</ div >
</ div >
</ div >
二、多前端框架實現下拉切換器(Interactive Dropdown Switcher)
透過正文內的下拉選單選擇目標技術框架,下方的內容面板將自動同步切換:
⚛️ React 19 (Hooks)
🟢 Vue 3.5 (Composition API)
🚀 Astro 6 (Islands)
🟠 Svelte 5 (Runes)
⚛️ React 19 計數器程式碼:
import { useState } from 'react';
export function Counter() {
const [count
评论