Runtime API Examples
This page demonstrates usage of some of the runtime APIs provided by VitePress.
The main useData() API can be used to access site, theme, and page data for the current page. It works in both .md and .vue files:
md
<script setup>
import { useData } from 'vitepress'
const { theme, page, frontmatter } = useData()
</script>
## Results
### Theme Data
<pre>{{ theme }}</pre>
### Page Data
<pre>{{ page }}</pre>
### Page Frontmatter
<pre>{{ frontmatter }}</pre>Results
Theme Data
{
"logo": {
"src": "/head-portrait-image.png",
"width": 24,
"height": 24,
"alt": "My Logo"
},
"nav": [
{
"text": "首页",
"link": "/"
},
{
"text": "底层探秘",
"link": "/cs/network/cs-network-01-layer"
},
{
"text": "人工智能",
"link": "/ai/deepseek-01-what"
},
{
"text": "Java面试",
"link": "/java/java-interview-hj-01"
},
{
"text": "Rust教程",
"link": "/rust/rust-axum-web-01"
},
{
"text": "技术文章",
"link": "/articles/git-commit-log-conventional_commits"
}
],
"sidebar": {
"/ai/": [
{
"text": "DeepSeek系列",
"items": [
{
"text": "1.算法炼金术-什么是DeepSeek?",
"link": "/ai/deepseek-01-what"
},
{
"text": "2.星辰与代码:DeepSeek的发展历程",
"link": "/ai/deepseek-02-development-history"
},
{
"text": "ChatGPT强势爆红,背后的技术原理是?一文轻松搞懂!",
"link": "/ai/2023-02-24_Principle_of_ChatGPT"
}
]
}
],
"/rust/": [
{
"text": "Axum高性能web系列",
"items": [
{
"text": "1.从入门到速通教程",
"link": "/rust/rust-axum-web-01"
},
{
"text": "2.集成日志功能Tracing",
"link": "/rust/rust-axum-web-02-log-tracing"
},
{
"text": "3.多种方式读取配置文件",
"link": "/rust/rust-axum-web-03-read-config"
}
]
}
],
"/java/": [
{
"text": "夯实基础",
"items": [
{
"text": "Java基础面试题集(2025版,1.8万字)",
"link": "/java/java-interview-hj-01"
},
{
"text": "深挖⾯向对象编程三⼤特性 --封装、继承、多态",
"link": "/java/2022-05-20_fz_jc_dt"
},
{
"text": "没那么简单的单例模式",
"link": "/java/2022-05-30_Singleton_mode"
},
{
"text": "谈谈JAVA中对象和类、this、super和static关键字",
"link": "/java/2022-05-04_object_this_super_static_talk"
},
{
"text": "类加载器与双亲委派机制一网打尽",
"link": "/java/2022-06-07_ClassLoader_and_parental_delegation_mechanism"
},
{
"text": "Java反射深入剖析",
"link": "/java/2022-06-12_java_reflection"
},
{
"text": "深入剖析Java注解及其底层原理",
"link": "/java/2022-06-16_Annotation_and_principle"
},
{
"text": "万字干货|JDK动态代理及其源码解析 拿捏了",
"link": "/java/2022-06-26_jdk_dynamic_proxy"
},
{
"text": "面试题: Java中为什么只有值传递?",
"link": "/java/2022-07-02_Java_pass_by_value"
},
{
"text": "面试题:深拷贝、浅拷贝、引用拷贝的区别",
"link": "/java/2022-07-11_The_difference_between_deep_copy_shallow_copy_and_reference_copy"
},
{
"text": "面试题: Java序列化与反序列化",
"link": "/java/2022-07-28_interview_serialization_and_deserialization"
},
{
"text": "面试题:海量数据处理利器,布隆过滤器",
"link": "/java/2022-08-16_Massive_data_processing_tool_bloom_filter"
},
{
"text": "Java内存模型(JMM)详解",
"link": "/java/2022-09-09_JMM_Explain_in_detail"
},
{
"text": "探究枚举与接口常量、类常量的区别",
"link": "/java/2022-09-22_Explore_difference_between_enumeration_interfaceContent_and_classConstant"
},
{
"text": "== 和 equals 的区别",
"link": "/java/2021-06-20_equals_=="
},
{
"text": "浅谈 toString()、String.valueOf、(String)强转?",
"link": "/java/2021-12-09_toString_stringValueOf_(String)"
},
{
"text": "浅谈面试中HashMap相关问题",
"link": "/java/2022-04-18_interview-about-hashmap"
},
{
"text": "面试题:PostgreSQL和MySQL区别 ",
"link": "/java/2022-05-17_interview_PostgreSQL_vs_MySQL"
},
{
"text": "volatile关键字在并发中有哪些作用?",
"link": "/java/2022-10-20_What_is_role_of_volatile_keyword_in_concurrency"
},
{
"text": "万字干货|Synchronized关键字详解",
"link": "/java/2022-10-30_Synchronized_Keyword_Details"
},
{
"text": "Java内存区域有哪些构成?",
"link": "/java/2022-11-20_Java_Memory_Region_Details"
},
{
"text": "原来还能这样看Java线程的状态及转换",
"link": "/java/2022-12-19_Status_and_Transition_of_Java_Threads"
},
{
"text": "聊聊JVM虚方法表和方法调用",
"link": "/java/2023-02-28_JVM_virtual_method_tables_and_method_calls"
},
{
"text": "图解ReentrantLock的基石AQS源码-独占锁的获取与释放",
"link": "/java/2023-06-21_AQS-Acquisition_and_Release_of_Exclusive_Locks"
},
{
"text": "AQS源码解析(2)-共享锁的获取与释放",
"link": "/java/2023-08-02_AQS_about_share_lock"
}
]
},
{
"text": "系统架构设计",
"items": [
{
"text": "聊聊项目如何设计幂等?",
"link": "/java/2023-03-06_How_to_design_idempotent"
},
{
"text": "如何快速弄懂缓存穿透、缓存击穿、缓存雪崩之间的区别?",
"link": "/java/2024-03-19_Cache_penetration_cache avalanche_cache_breakdown"
},
{
"text": "引入缓存竟然会带来这么多问题??!",
"link": "/java/2024-04-03_Why_does_introducing_caching_bring_so_many_problems"
}
]
}
],
"/cs/": [
{
"text": "计算机网络",
"items": [
{
"text": "化繁为简:计算机网络分层的详解",
"link": "/cs/network/cs-network-01-layer"
},
{
"text": "互联网下的隐藏\"坐标\":IP 地址到底是什么?",
"link": "/cs/network/cs-network-40-ip-address"
},
{
"text": "图解IP地址的奥秘:组成与分类",
"link": "/cs/network/cs-network-41-ip-address-classification"
},
{
"text": "TCP为什么握手要3回,挥手4次?深入浅出给你图解",
"link": "/cs/network/cs-network-50-tcp-handshake-take-3-times-and-wave-4-times"
},
{
"text": "什么是http协议,从http0.9到http3.0发展历程的回首",
"link": "/cs/network/cs-network-70-http-development"
},
{
"text": "从HTTP0.9到HTTP3.0发展历程的万字回首与展望",
"link": "/cs/network/2023-12-04_http_http0.9_to_http3.0"
}
]
},
{
"text": "Linux0.12",
"items": [
{
"text": "聊聊x86计算机启动发生的事",
"link": "/cs/linux/linux0.12-01-x86-computer-started"
},
{
"text": "Linux0.12内核源码解读(2)-Bootsect.S",
"link": "/cs/linux/linux0.12-02-bootsect"
},
{
"text": "Linux0.12内核源码解读(3)-Setup.S",
"link": "/cs/linux/linux0.12-03-Setup"
},
{
"text": "Linux0.12内核源码解读(4)-图解CPU的实模式与保护模式",
"link": "/cs/linux/linux0.12-04-Diagram_real_mode_and_protected_mode_of_CPU"
},
{
"text": "Linux0.12内核源码解读(5)-head.s",
"link": "/cs/linux/linux0.12-05-head.s"
},
{
"text": "Linux0.12内核源码解读(6)-main.c",
"link": "/cs/linux/linux0.12-06-main"
},
{
"text": "Linux0.12内核源码解读(7)-陷阱门初始化",
"link": "/cs/linux/linux0.12-07-trap-init"
},
{
"text": "Linux0.12内核源码解读(8)-图解计算机中断",
"link": "/cs/linux/2023-10-17_graphic_computer_interrupt"
},
{
"text": "Linux0.12内核源码解读(9)-blk_dev_init和chr_dev_init",
"link": "/cs/linux/2023-11-16_Linux0.12-blk_dev_init_and_chr_dev_init"
},
{
"text": "Linux0.12内核源码解读(10)-什么是系统调用机制?结合Linux0.12源码图解",
"link": "/cs/linux/2023-12-26_What_is_a_system_call_mechanism"
},
{
"text": "Linux0.12内核源码解读(11)-tty是什么?聊聊linux0.12中tty与time的初始化",
"link": "/cs/linux/2024-02-29_linux0.12_tty_time"
},
{
"text": "linux0.12内核源码解读(12)-任务调度初始化sched_init",
"link": "/cs/linux/2024-05-30_sched_init"
}
]
},
{
"text": "计算机组成原理",
"items": [
{
"text": "计算机的基本组成是什么样子的?",
"link": "/cs/cs/2022-09-01_What_is_the_basic_composition_of_computer"
},
{
"text": "计算机硬件的读写速度差异",
"link": "/cs/cs/2022-08-03_Read_and_write_speed_difference_of_computer_hardware"
},
{
"text": "聊聊计算机中的寄存器",
"link": "/cs/cs/2022-10-02_Talk_about_registers_in_computer"
},
{
"text": "聊聊GPU与CPU的区别",
"link": "/cs/cs/2022-10-07_Talk_about_the_difference_between_GPU_and_CPU"
},
{
"text": "聊聊CPU的发展历程之单核、多核、超线程",
"link": "/cs/cs/2022-11-10_Talk_about_development_of_CPU_single_core_multi-core"
},
{
"text": "计算机中数值和字符串怎么用二进制表示?",
"link": "/cs/cs/2022-11-29_Computer_values_and_codes"
},
{
"text": "什么是计算机中的高速公路-总线?",
"link": "/cs/cs/2022-12-08_What_is_highway_in_computer_bus"
},
{
"text": "聊聊开关和CPU之间故事",
"link": "/cs/cs/2022-12-25_Talk_about_the_story_between_switch_and_CPU"
},
{
"text": "简易加法器的实现",
"link": "/cs/cs/2023-01-08_Implementation_of_simple_adder"
},
{
"text": "减法器的设计与实现并用译码器显示16、10进制",
"link": "/cs/cs/2023-02-01_Subtractor_decoder_selector_implementation"
},
{
"text": "漫谈从RS触发器到D触发器的发展历程",
"link": "/cs/cs/2023-03-14_from_RS_to_D_trigger"
},
{
"text": "突破计算机性能瓶颈的利器CPU Cache",
"link": "/cs/cs/2023-07-14_CPU_Cache_01"
},
{
"text": "CPU Cache是如何映射与寻址的?",
"link": "/cs/cs/2023-09-01_CPU_Cache_Mapping_and_Addressing"
},
{
"text": "CPU Cache是如何保证缓存一致性?",
"link": "/cs/cs/2023-09-29_How_%20does_CPU_Cache_ensure_cache_consistency"
},
{
"text": "如何利用缓存,让CPU更有效率地执行代码?",
"link": "/cs/cs/2023-11-01_How_to_utilize_cache_to_make_CPU_execute_code_more_efficiently"
},
{
"text": "你了解计算机中大端小端之分吗?",
"link": "/cs/cs/2024-01-18_large_and_small_terminals_in_computers"
},
{
"text": "能够自我检错并纠错的编码-校验码",
"link": "/cs/cs/2024-04-28_Check_Code"
}
]
},
{
"text": "操作系统",
"items": [
{
"text": "聊聊Linux中CPU上下文切换",
"link": "/cs/linux/2022-08-22_Talk_about_CPU_context_switching_in_Linux"
}
]
}
],
"/articles/": [
{
"items": [
{
"text": "告别fix bug!拯救Git Commit Log的规范",
"link": "/articles/git-commit-log-conventional_commits"
},
{
"text": "Linux用户必备:Ubuntu如何快速查看版本",
"link": "/articles/ubuntu/ubuntu-01-version-check"
}
]
}
]
},
"sidebarMenuLabel": "目录",
"outline": {
"level": [
2,
6
],
"label": "本页目录"
},
"footer": {
"message": "<a href=\"https://beian.miit.gov.cn/\" target=\"_blank\">苏ICP备2021011886号-1</a>",
"copyright": "Copyright © 2020-present xiaoniuhululu"
},
"lastUpdatedText": "最后更新",
"socialLinks": [
{
"icon": "github",
"link": "https://github.com/xiaoniuhululu"
}
],
"search": {
"provider": "local"
},
"returnToTopLabel": "返回顶部"
}Page Data
{
"title": "Runtime API Examples",
"description": "",
"frontmatter": {
"outline": "deep"
},
"headers": [],
"relativePath": "api-examples.md",
"filePath": "api-examples.md",
"lastUpdated": 1746543656000
}Page Frontmatter
{
"outline": "deep"
}More
Check out the documentation for the full list of runtime APIs.