Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-03-24 16:49:55 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1efaae605f1b85b045dc807024c1f067a3aedee5
1efaae60
1 parent
f5aaebb1
feat: 添加课程详情页的收藏功能
在课程详情页中添加收藏按钮,点击按钮可以切换收藏状态。按钮的图标颜色会根据收藏状态动态变化
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
src/views/courses/CourseDetailPage.vue
src/views/courses/CourseDetailPage.vue
View file @
1efaae6
...
...
@@ -219,13 +219,13 @@
</svg>
分享
</button> -->
<button class="flex flex-col items-center text-gray-500 text-xs">
<button class="flex flex-col items-center text-gray-500 text-xs"
@click="toggleFavorite"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
fill="none
"
:fill="isFavorite ? 'red' : 'none'
"
viewBox="0 0 24 24"
stroke="currentColor
"
:stroke="isFavorite ? 'red' : 'currentColor'
"
>
<path
stroke-linecap="round"
...
...
@@ -271,8 +271,15 @@ const route = useRoute()
const router = useRouter()
const course = ref(null)
const activeTab = ref('课程特色')
const isFavorite = ref(false)
const { addToCart, proceedToCheckout } = useCart()
// Handle favorite toggle
const toggleFavorite = () => {
isFavorite.value = !isFavorite.value
// TODO: 后续对接收藏接口
}
// Curriculum items
const curriculumItems = [
{ title: '课程特色', active: true },
...
...
Please
register
or
login
to post a comment