Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vue-bootstrap5-components
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ljelonek-public
vue-bootstrap5-components
Commits
a92058b5
Commit
a92058b5
authored
3 years ago
by
Lukas Jelonek
Browse files
Options
Downloads
Patches
Plain Diff
Add notification component
parent
f14075bc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dev/serve.vue
+12
-0
12 additions, 0 deletions
dev/serve.vue
src/lib-components/Notification.vue
+73
-0
73 additions, 0 deletions
src/lib-components/Notification.vue
src/lib-components/index.js
+1
-0
1 addition, 0 deletions
src/lib-components/index.js
with
86 additions
and
0 deletions
dev/serve.vue
+
12
−
0
View file @
a92058b5
...
...
@@ -18,6 +18,11 @@ export default defineComponent({
return
{
text
:
""
,
results
:
[],
error
:
{
text
:
"
mehr text
"
,
variant
:
"
danger
"
,
dismissible
:
true
,
},
};
},
methods
:
{
...
...
@@ -33,6 +38,7 @@ export default defineComponent({
);
});
},
doSomething
:
function
(
evt
)
{
console
.
log
(
evt
);
},
...
...
@@ -59,7 +65,13 @@ export default defineComponent({
<panel-with-sidebox
sideboxWidth=
"200px"
>
<template
v-slot:default
>
<h1>
Component examples
</h1>
<row-entry
label=
"Something"
>
Test
</row-entry>
<notification
modelValue=
"text"
/>
<notification
:modelValue=
"
{ text: 'mehr text', variant: 'danger' }"
/>
<notification
v-model=
"error"
/>
<form-group-text-box
v-model=
"text"
label=
"Input data"
...
...
This diff is collapsed.
Click to expand it.
src/lib-components/Notification.vue
0 → 100644
+
73
−
0
View file @
a92058b5
<
template
>
<div
:class=
"classes"
role=
"alert"
ref=
"alert"
>
{{
text
}}
<button
v-if=
"dismissible"
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"alert"
aria-label=
"Close"
></button>
</div>
</
template
>
<
script
>
export
default
{
props
:
{
modelValue
:
{
type
:
Object
,
default
:
()
=>
{}
}
},
mounted
:
function
()
{
if
(
this
.
$refs
.
alert
)
{
this
.
$refs
.
alert
.
addEventListener
(
"
closed.bs.alert
"
,
this
.
disable
);
}
},
methods
:
{
disable
:
function
()
{
this
.
$emit
(
"
update:modelValue
"
,
null
);
console
.
log
(
"
click
"
);
},
},
computed
:
{
classes
:
function
()
{
let
classes
=
"
alert alert-
"
+
this
.
variant
+
"
fade show
"
;
if
(
this
.
dismissible
)
{
classes
+=
"
alert-dismissible
"
;
}
return
classes
;
},
text
:
function
()
{
if
(
this
.
modelValue
&&
typeof
this
.
modelValue
===
"
string
"
)
{
return
this
.
modelValue
;
}
else
{
if
(
this
.
modelValue
&&
"
text
"
in
this
.
modelValue
)
{
return
this
.
modelValue
.
text
;
}
else
{
return
"
Illegal notification message structure
"
;
}
}
},
variant
:
function
()
{
if
(
this
.
modelValue
&&
typeof
this
.
modelValue
===
"
object
"
&&
"
variant
"
in
this
.
modelValue
)
{
return
this
.
modelValue
.
variant
;
}
else
{
return
"
info
"
;
}
},
dismissible
:
function
()
{
if
(
this
.
modelValue
&&
typeof
this
.
modelValue
===
"
object
"
&&
"
dismissible
"
in
this
.
modelValue
)
{
return
this
.
modelValue
.
dismissible
;
}
else
{
return
false
;
}
},
},
};
</
script
>
<
style
></
style
>
This diff is collapsed.
Click to expand it.
src/lib-components/index.js
+
1
−
0
View file @
a92058b5
...
...
@@ -16,3 +16,4 @@ export { default as SidebarButton } from "./SidebarButton.vue";
export
{
default
as
SidebarEntry
}
from
"
./SidebarEntry.vue
"
;
export
{
default
as
SidebarHeading
}
from
"
./SidebarHeading.vue
"
;
export
{
default
as
SidebarList
}
from
"
./SidebarList.vue
"
;
export
{
default
as
Notification
}
from
"
./Notification.vue
"
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment