Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jingan-wisdom
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
郭铭瑶
jingan-wisdom
Commits
9858c96c
Commit
9858c96c
authored
Oct 09, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整
parent
58efbc50
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
+22
-11
my-progress.vue
src/components/MyComponent/MyProgress/my-progress.vue
+1
-0
useComponent.ts
src/hooks/useComponent.ts
+3
-3
useConfig.ts
src/hooks/useConfig.ts
+16
-6
useLayout.ts
src/hooks/useLayout.ts
+2
-2
No files found.
src/components/MyComponent/MyProgress/my-progress.vue
View file @
9858c96c
...
@@ -22,6 +22,7 @@ export interface ProgressProps {
...
@@ -22,6 +22,7 @@ export interface ProgressProps {
name
?:
string
name
?:
string
value
?:
number
value
?:
number
unit
?:
string
unit
?:
string
color
?:
string
}
}
export
default
defineComponent
({
export
default
defineComponent
({
name
:
'MyProgress'
,
name
:
'MyProgress'
,
...
...
src/hooks/useComponent.ts
View file @
9858c96c
import
{
ref
,
computed
}
from
'vue'
import
{
ref
,
computed
}
from
'vue'
import
list
from
'@/utils/component-list'
import
list
from
'@/utils/component-list'
import
useConfig
from
'./useConfig'
import
useConfig
,
{
Config
}
from
'./useConfig'
export
default
function
useComponent
()
{
export
default
function
useComponent
()
{
const
showComponentModal
=
ref
(
false
)
// 展示组件选择框
const
showComponentModal
=
ref
(
false
)
// 展示组件选择框
const
curBox
=
ref
<
number
|
null
>
(
null
)
// 当前容器下标
const
curBox
=
ref
<
number
|
null
>
(
null
)
// 当前容器下标
const
components
=
ref
<
{
[
key
:
number
]:
string
}
>
({})
// {容器下标: 组件key}
const
components
=
ref
<
Config
[
'components'
]
>
({})
// {容器下标: 组件key}
const
config
=
useConfig
()
// 获取组件选择配置
const
config
=
useConfig
()
// 获取组件选择配置
if
(
config
?.
components
)
{
if
(
config
?.
components
)
{
...
@@ -24,7 +24,7 @@ export default function useComponent() {
...
@@ -24,7 +24,7 @@ export default function useComponent() {
}
}
const
onCancelComponent
=
(
i
:
number
)
=>
{
const
onCancelComponent
=
(
i
:
number
)
=>
{
// 取消组件
// 取消组件
delete
components
.
value
[
i
]
delete
components
.
value
?.
[
i
]
}
}
const
componentList
=
computed
(()
=>
list
)
// key值-组件 对照表
const
componentList
=
computed
(()
=>
list
)
// key值-组件 对照表
...
...
src/hooks/useConfig.ts
View file @
9858c96c
interface
Config
{
export
interface
Config
{
layout
?
:
{
template
:
string
[];
rows
:
string
;
boxNum
:
number
}
layout
:
{
template
:
string
[];
rows
:
string
;
boxNum
:
number
}
components
?
:
{
[
key
:
number
]:
string
}
components
:
{
[
key
:
number
]:
string
}
}
}
export
default
function
useConfig
(
config
?:
string
)
{
export
default
function
useConfig
(
config
?:
string
)
{
...
@@ -11,7 +11,17 @@ export default function useConfig(config?: string) {
...
@@ -11,7 +11,17 @@ export default function useConfig(config?: string) {
}
}
// 获取配置
// 获取配置
let
data
=
window
.
sessionStorage
.
getItem
(
'__layout_components__'
)
const
data
=
window
.
sessionStorage
.
getItem
(
'__layout_components__'
)
data
&&
(
data
=
JSON
.
parse
(
data
))
if
(
data
)
{
return
data
as
Config
return
JSON
.
parse
(
data
)
as
Config
}
else
{
return
{
layout
:
{
template
:
[],
rows
:
''
,
boxNum
:
0
,
},
components
:
{},
}
}
}
}
src/hooks/useLayout.ts
View file @
9858c96c
import
{
ref
}
from
'vue'
import
{
ref
}
from
'vue'
import
useConfig
from
'./useConfig'
import
useConfig
,
{
Config
}
from
'./useConfig'
export
default
function
useLayout
()
{
export
default
function
useLayout
()
{
const
showLayoutModal
=
ref
(
false
)
// 展示布局选择弹窗
const
showLayoutModal
=
ref
(
false
)
// 展示布局选择弹窗
const
layout
=
ref
<
{
template
:
string
[];
rows
:
string
;
boxNum
:
number
}
>
({
const
layout
=
ref
<
Config
[
'layout'
]
>
({
// 布局内容设置
// 布局内容设置
template
:
[],
template
:
[],
rows
:
''
,
rows
:
''
,
...
...
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