From 7ea12f3c8901a3623050739b01817e1de3ebd7a5 Mon Sep 17 00:00:00 2001 From: dohodin Date: Tue, 7 Mar 2023 08:28:03 +0100 Subject: [PATCH] Form for Team and component Navbar working, link are not bind now --- index.html | 10 ++++++++-- src/misc/constant.js | 1 + src/view/link_service.js | 3 ++- src/view/navbar.js | 4 ++-- src/view/team_add.js | 42 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 src/misc/constant.js create mode 100644 src/view/team_add.js diff --git a/index.html b/index.html index b4385cb..3498712 100644 --- a/index.html +++ b/index.html @@ -11,11 +11,16 @@
+
+ + + diff --git a/src/misc/constant.js b/src/misc/constant.js new file mode 100644 index 0000000..322ba48 --- /dev/null +++ b/src/misc/constant.js @@ -0,0 +1 @@ +const ERROR_COLOR = 'red'; \ No newline at end of file diff --git a/src/view/link_service.js b/src/view/link_service.js index 1c533ed..c4e1093 100644 --- a/src/view/link_service.js +++ b/src/view/link_service.js @@ -2,9 +2,10 @@ export default class LinkService{ getLinks(){ return [ - 'https://www.google.com', + '', 'https://www.youtube.com', 'https://www.github.com', ]; } + } diff --git a/src/view/navbar.js b/src/view/navbar.js index 151b493..2074fc7 100644 --- a/src/view/navbar.js +++ b/src/view/navbar.js @@ -1,11 +1,11 @@ export default { template:` -
+
-
+ ` }; \ No newline at end of file diff --git a/src/view/team_add.js b/src/view/team_add.js new file mode 100644 index 0000000..33537fe --- /dev/null +++ b/src/view/team_add.js @@ -0,0 +1,42 @@ +export default { + data: function() { + return { + id: '', + name: '', + errorMessage: '', + errorColor: ERROR_COLOR + } + }, + methods: { + addTeam: function() { + this.errorMessage = ''; + if (!this.id || !this.name) { + this.errorMessage = 'ID and Name are required !'; + return; + } + + const team = { id: this.id, name: this.name}; + console.log('form.addTeam', team); + + this.$emit('addTeam', team); + + this.id = ''; + this.name = ''; + } + }, + template: `
+

News form

+
+
{{ errorMessage }}
+
+
+ +
+
+
+ +
+ +
+
` +} \ No newline at end of file