P粉1514660812023-08-29 00:00:30
這裡是工作遊樂場與vue3-burger-menu 範例。
https://stackblitz.com/edit/vue-wwkpny ?file=src/App.vue
#您必須將問題中的程式碼放入自訂元件中。
像這樣:
MyMenu.vue
<template> <Slide> <a id="home" href="#"> <span>Home</span> </a> </Slide> </template> <script> import { Slide } from 'vue3-burger-menu' // import the CSS transitions you wish to use, in this case we are using `Slide` export default { components: { Slide // Register your component } } </script>
並在應用程式中使用它:
App.vue
#<template> <div id="app"> <MyMenu /> </div> </template> <script> import MyMenu from './components/MyMenu.vue' export default { name: 'App', components: { MyMenu } } </script>