Vue3 网站收藏

一、官方网站

1.Vue.js

https://vuejs.org/
https://staging-cn.vuejs.org/
https://github.com/vuejs/

2.Vite

https://vitejs.dev/
https://cn.vitejs.dev/
https://github.com/vitejs/docs-cn

3.VuePress

https://v2.vuepress.vuejs.org/
https://v2.vuepress.vuejs.org/zh/
https://github.com/vuepress/vuepress-next

4.VitePress

https://vitepress.vuejs.org/
https://github.com/vuejs/vitepress

二、示例网站

1.Office-Tool-docs

https://help.coolhub.top/zh-cn/
https://github.com/YerongAI/Office-Tool-docs

首先,你需要在你的项目中安装Ant Design VueVue Router。然后,你可以创建一个收藏页面和一个收藏按钮组件。 在收藏按钮组件中,你需要添加一个点击事件来将当前页面添加到收藏夹中。你可以使用localStorage来存储收藏的页面。 在收藏页面中,你可以从localStorage中获取所有收藏的页面并将它们显示在页面上。你可以使用Ant Design Vue的Card组件来显示每个收藏的页面。 下面是一个简单的示例代码: 收藏按钮组件: ```html <template> <a-button type="primary" @click="addToFavorites">Add to favorites</a-button> </template> <script> export default { methods: { addToFavorites() { const currentUrl = window.location.href; let favorites = JSON.parse(localStorage.getItem(&#39;favorites&#39;)) || []; if (!favorites.includes(currentUrl)) { favorites.push(currentUrl); localStorage.setItem(&#39;favorites&#39;, JSON.stringify(favorites)); } } } }; </script> ``` 收藏页面: ```html <template> <div> <a-card v-for="(url, index) in favorites" :key="index"> <a href="url">{{ url }}</a> </a-card> </div> </template> <script> export default { data() { return { favorites: [] }; }, mounted() { const storedFavorites = localStorage.getItem(&#39;favorites&#39;); if (storedFavorites) { this.favorites = JSON.parse(storedFavorites); } } }; </script> ``` 在你的路由器中,你需要创建一个指向收藏页面的路由: ```javascript import Favorites from &#39;./components/Favorites.vue&#39;; const routes = [ { path: &#39;/favorites&#39;, component: Favorites } ]; ``` 现在,你可以在你的应用程序中使用收藏按钮组件,并在收藏页面中查看和管理收藏的页面。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值