Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
f62f378f
Unverified
Commit
f62f378f
authored
Jun 08, 2021
by
Leo Caan (陈栋)
Committed by
GitHub
Jun 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: add util for install component (#707)
parent
6d5f9aa6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
index.ts
src/components/CodeEditor/index.ts
+3
-12
index.ts
src/components/FlowChart/index.ts
+2
-6
install.ts
src/utils/install.ts
+12
-0
No files found.
src/components/CodeEditor/index.ts
View file @
f62f378f
import
type
{
App
}
from
'
vue
'
;
import
{
install
}
from
'
/@/utils/install
'
;
import
codeEditor
from
'
./src/CodeEditor.vue
'
;
import
jsonPreview
from
'
./src/json-preview/JsonPreview.vue
'
;
export
const
CodeEditor
=
Object
.
assign
(
codeEditor
,
{
install
(
app
:
App
)
{
app
.
component
(
codeEditor
.
name
,
codeEditor
);
},
});
export
const
JsonPreview
=
Object
.
assign
(
jsonPreview
,
{
install
(
app
:
App
)
{
app
.
component
(
jsonPreview
.
name
,
jsonPreview
);
},
});
export
const
CodeEditor
=
install
(
codeEditor
);
export
const
JsonPreview
=
install
(
jsonPreview
);
src/components/FlowChart/index.ts
View file @
f62f378f
import
type
{
App
}
from
'
vue
'
;
import
{
install
}
from
'
/@/utils/install
'
;
import
flowChart
from
'
./src/FlowChart.vue
'
;
export
const
FlowChart
=
Object
.
assign
(
flowChart
,
{
install
(
app
:
App
)
{
app
.
component
(
flowChart
.
name
,
flowChart
);
},
});
export
const
FlowChart
=
install
(
flowChart
);
src/utils/install.ts
0 → 100644
View file @
f62f378f
import
{
App
,
Plugin
}
from
'
vue
'
;
export
const
install
=
<
T
>
(
component
:
T
,
alias
?:
string
)
=>
{
const
C
=
component
as
any
;
C
.
install
=
(
app
:
App
)
=>
{
app
.
component
(
C
.
name
,
component
);
if
(
alias
)
{
app
.
config
.
globalProperties
[
alias
]
=
component
;
}
};
return
component
as
T
&
Plugin
;
};
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