- Implement dynamic styles and event handling in Vue2 with a card component. - Create lifecycle methods exercise to simulate async data loading and instance destruction. - Develop a component communication exercise with props, events, and slots. - Build a comprehensive course management dashboard with filtering, statistics, and component interactions.
18 lines
375 B
JavaScript
18 lines
375 B
JavaScript
new Vue({
|
|
el: "#app",
|
|
data: {
|
|
courseTitle: "Vue2 模板语法",
|
|
teacher: "李老师",
|
|
coverUrl: "https://picsum.photos/800/320?random=21",
|
|
courseLink: "https://cn.vuejs.org/",
|
|
isCollected: false,
|
|
},
|
|
methods: {
|
|
toggleCollect() {
|
|
// 任务:
|
|
// 1. 切换 isCollected
|
|
// 2. 在控制台输出最新收藏状态
|
|
},
|
|
},
|
|
});
|