P粉1514660812023-08-29 00:00:30
Here is a working playground with vue3-burger-menu example.
https://stackblitz.com/edit/vue-wwkpny ?file=src/App.vue
You must put the code in the question into a custom component.
like this:
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>
and use it in your application:
App.vue
<template> <div id="app"> <MyMenu /> </div> </template> <script> import MyMenu from './components/MyMenu.vue' export default { name: 'App', components: { MyMenu } } </script>