# 进阶用法 ### 介绍 通过本章节你可以了解到 Vant 的一些进阶用法,比如组件插槽用法、多种浏览器适配方式。 ## 组件用法 ### 组件注册 Vant 支持多种组件注册方式,请根据实际业务需要进行选择。 #### 全局注册 全局注册后,你可以在 app 下的任意子组件中使用注册的 Vant 组件。 ```js import { Button } from 'vant'; import { createApp } from 'vue'; const app = createApp(); // 方式一. 通过 app.use 注册 // 注册完成后,在模板中通过 标签来使用按钮组件 app.use(Button); // 方式二. 通过 app.component 注册 // 注册完成后,在模板中通过 标签来使用按钮组件 app.component(Button.name, Button); ``` #### 局部注册 局部注册后,你可以在当前组件中使用注册的 Vant 组件。 ```js import { Button } from 'vant'; export default { components: { [Button.name]: Button, }, }; ``` > 对于组件注册更详细的介绍,请参考 [Vue 官方文档 - 组件注册](https://v3.cn.vuejs.org/guide/component-registration.html#%E7%BB%84%E4%BB%B6%E6%B3%A8%E5%86%8C)。 #### \ ``` #### JSX/TSX 在 JSX 和 TSX 中可以直接使用 Vant 组件,不需要进行组件注册。 ```jsx import { Button } from 'vant'; export default { render() { return