Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
0454a6e3
Commit
0454a6e3
authored
Dec 21, 2021
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义列表组件
parent
10dfbe6a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
8 deletions
+53
-8
src/api/index.js
+5
-0
src/components/custom-list/index.vue
+46
-6
src/pages/home/index.vue
+2
-2
No files found.
src/api/index.js
View file @
0454a6e3
...
@@ -84,6 +84,10 @@ console.log(process.env,'-----------------config------')
...
@@ -84,6 +84,10 @@ console.log(process.env,'-----------------config------')
getVehicleNumber
(
number
)
{
getVehicleNumber
(
number
)
{
return
requestGET
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/generatorUniqueCodeByCarDynamic?numberPlate=
${
encodeURIComponent
(
number
)}
`
)
return
requestGET
(
`
${
process
.
env
.
OLSHOP_URL
}
/user/generatorUniqueCodeByCarDynamic?numberPlate=
${
encodeURIComponent
(
number
)}
`
)
},
},
// 获取数据源
outDataSourceData
(
data
)
{
return
requestPOST
(
`
${
process
.
env
.
OLSHOP_URL
}
/outDataSource/api`
,
data
)
},
}
}
\ No newline at end of file
src/components/custom-list/index.vue
View file @
0454a6e3
<
template
>
<
template
>
<!-- 自定义列表 -->
<!-- 自定义列表 -->
<div
class=
"customList"
:style=
"
{'padding':padding+'px','margin': margin+'px','border-radius': borderRadius + 'px','background':backgroundColor}">
<div
class=
"customList"
v-if=
"loaded && comDataList.length>0"
:style=
"
{'padding':padding+'px','margin': margin+'px','border-radius': borderRadius + 'px','background':backgroundColor}">
<div
v-for=
"(item,index) in
4
"
:key=
"index"
@
click=
"itemClick(item,index)"
>
<div
v-for=
"(item,index) in
comDataList
"
:key=
"index"
@
click=
"itemClick(item,index)"
>
<rich-text
:nodes=
"comStr"
></rich-text>
<rich-text
:nodes=
"
item.
comStr"
></rich-text>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -20,6 +20,7 @@ function compiler(str, data) {
...
@@ -20,6 +20,7 @@ function compiler(str, data) {
return
str
;
return
str
;
}
}
import
Vue
from
"vue"
;
import
Vue
from
"vue"
;
import
index
from
"@/api/index"
;
export
default
{
export
default
{
name
:
"custom-list"
,
name
:
"custom-list"
,
props
:
{
props
:
{
...
@@ -35,7 +36,9 @@ export default {
...
@@ -35,7 +36,9 @@ export default {
},
},
},
},
data
()
{
data
()
{
return
{};
return
{
loaded
:
false
,
};
},
},
computed
:{
computed
:{
comStr
(){
comStr
(){
...
@@ -53,13 +56,50 @@ export default {
...
@@ -53,13 +56,50 @@ export default {
backgroundColor
()
{
backgroundColor
()
{
return
this
.
datas
.
componentData
.
backgroundColor
;
return
this
.
datas
.
componentData
.
backgroundColor
;
},
},
showCont
()
{
return
this
.
datas
.
componentData
.
showCont
;
},
dataSourceObj
()
{
return
this
.
datas
.
componentData
.
dataSourceObj
;
},
comDataList
:
{
get
()
{
return
this
.
datas
.
componentData
.
comDataList
||
[];
},
set
(
newValue
)
{
this
.
datas
.
componentData
.
comDataList
=
newValue
;
},
},
},
created
()
{
this
.
getList
();
},
},
created
()
{},
mounted
()
{},
mounted
()
{},
methods
:{
methods
:{
itemClick
(
item
,
index
){
itemClick
(
item
,
index
){
eval
(
this
.
datas
.
componentData
.
comMethods
)
eval
(
this
.
datas
.
componentData
.
comMethods
)
}
},
getList
(){
let
query
=
{
...
this
.
dataSourceObj
,
current
:
1
,
size
:
this
.
showCont
,
}
index
.
outDataSourceData
(
query
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
){
this
.
comDataList
=
res
.
data
.
data
.
records
||
[];
if
(
this
.
comDataList
&&
this
.
comDataList
.
length
>
0
){
this
.
comDataList
.
forEach
((
item
,
index
)
=>
{
item
.
comStr
=
compiler
(
this
.
datas
.
componentData
.
comStr
,
item
);
})
}
}
this
.
loaded
=
true
;
})
},
getComStr
(
item
){
compiler
(
this
.
datas
.
componentData
.
comStr
,
item
);
},
},
},
components
:
{},
components
:
{},
};
};
...
...
src/pages/home/index.vue
View file @
0454a6e3
...
@@ -93,9 +93,9 @@
...
@@ -93,9 +93,9 @@
<div
v-if=
"item.componentCode == 'wo-timeout' && item.componentInfo.visible == 1"
>
<div
v-if=
"item.componentCode == 'wo-timeout' && item.componentInfo.visible == 1"
>
<wo-timeout
:datas=
"item"
></wo-timeout>
<wo-timeout
:datas=
"item"
></wo-timeout>
</div>
</div>
<
!--
<
div
v-if=
"item.componentCode == 'custom-list' && item.componentInfo.visible == 1"
>
<div
v-if=
"item.componentCode == 'custom-list' && item.componentInfo.visible == 1"
>
<custom-list
:datas=
"item"
></custom-list>
<custom-list
:datas=
"item"
></custom-list>
</div>
-->
</div>
</div>
</div>
<bottomCont></bottomCont>
<bottomCont></bottomCont>
...
...
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