<!DOCTYPE html>
<
html
>
<
head
>
<
title
>Example 1</
title
>
<
script
src
=
</
script
>
</
head
>
<
body
>
<
div
id
=
"GFGCourses"
>
<
h2
>GeeksforGeeks Courses</
h2
>
<
div
v-for
=
"course in courses"
:key
=
"course.id"
>
<
p
>
<
strong
>{{ course.name }}:</
strong
>
{{ course.type | courseCategory }}
</
p
>
</
div
>
</
div
>
<
script
>
const GFGCourses = new Vue({
el: "#GFGCourses",
data: {
courses: [
{ id: 1, name: "JavaScript Basics",
type: "programming" },
{ id: 2, name: "Data Structures in Python",
type: "programming" },
{ id: 3, name: "Introduction to Machine Learning",
type: "data-science" },
{ id: 4, name: "Web Development with React",
type: "web-development" },
{ id: 5, name: "Networking Fundamentals",
type: "networking" },
],
},
filters: {
courseCategory: function (type) {
switch (type) {
case "programming":
return "Programming Course";
case "data-science":
return "Data Science Course";
case "web-development":
return "Web Development Course";
case "networking":
return "Networking Course";
default:
return "Other Course";
}
},
},
});
</
script
>
</
body
>
</
html
>