Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
7877edec
Commit
7877edec
authored
May 11, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `createComponentWithMixin` to create anonymous components with mixin
parent
03401338
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
spec/javascripts/helpers/vue_mount_component_helper.js
spec/javascripts/helpers/vue_mount_component_helper.js
+19
-3
No files found.
spec/javascripts/helpers/vue_mount_component_helper.js
View file @
7877edec
import
Vue
from
'
vue
'
;
const
mountComponent
=
(
Component
,
props
=
{},
el
=
null
)
=>
new
Component
({
propsData
:
props
,
}).
$mount
(
el
);
export
const
createComponentWithStore
=
(
Component
,
store
,
propsData
=
{})
=>
new
Component
({
store
,
propsData
,
});
export
const
createComponentWithMixin
=
(
mixins
=
[],
state
=
{},
props
=
{},
template
=
'
<div></div>
'
)
=>
{
const
Component
=
Vue
.
extend
({
template
,
mixins
,
data
()
{
return
props
;
},
});
return
mountComponent
(
Component
,
props
);
};
export
const
mountComponentWithStore
=
(
Component
,
{
el
,
props
,
store
})
=>
new
Component
({
store
,
propsData
:
props
||
{
},
}).
$mount
(
el
);
export
default
(
Component
,
props
=
{},
el
=
null
)
=>
new
Component
({
propsData
:
props
,
}).
$mount
(
el
);
export
default
mountComponent
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment