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
ed3d9eb6
Commit
ed3d9eb6
authored
Dec 16, 2021
by
李嘉林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
自定义列表组件注释
parent
54dc6df0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
1 deletions
+77
-1
src/components/custom-list/index.vue
+71
-0
src/pages/home/index.vue
+6
-1
No files found.
src/components/custom-list/index.vue
0 → 100644
View file @
ed3d9eb6
<
template
>
<!-- 自定义列表 -->
<div
class=
"customList"
: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)"
>
<rich-text
:nodes=
"comStr"
></rich-text>
</div>
</div>
</
template
>
<
script
type=
"text/ecmascript-6"
>
function
compiler
(
str
,
data
)
{
//正则表达式 .+匹配{{}}所有字符 ?取消贪婪 g全局
let
regulation
=
/
\{\{(
.+
?)\}\}
/g
;
str
=
str
.
replace
(
regulation
,
function
(
_
,
val
)
{
let
key
=
val
.
trim
();
//调用 对象嵌套函数
let
value
=
data
[
key
];
return
value
;
});
return
str
;
}
import
Vue
from
"vue"
;
export
default
{
name
:
"custom-list"
,
props
:
{
render
:
{
type
:
Boolean
,
default
:
false
,
},
datas
:
{
type
:
Object
,
default
:
()
=>
{
return
{};
},
},
},
data
()
{
return
{};
},
computed
:{
comStr
(){
return
compiler
(
this
.
datas
.
componentData
.
comStr
,
this
.
datas
.
componentData
.
comData
);
},
padding
()
{
return
this
.
datas
.
componentData
.
padding
;
},
margin
()
{
return
this
.
datas
.
componentData
.
margin
;
},
borderRadius
()
{
return
this
.
datas
.
componentData
.
borderRadius
;
},
backgroundColor
()
{
return
this
.
datas
.
componentData
.
backgroundColor
;
},
},
created
()
{},
mounted
()
{},
methods
:{
itemClick
(
item
,
index
){
eval
(
this
.
datas
.
componentData
.
comMethods
)
}
},
components
:
{},
};
</
script
>
<
style
lang=
"scss"
scoped
>
.customList
{
}
</
style
>
src/pages/home/index.vue
View file @
ed3d9eb6
...
...
@@ -93,6 +93,9 @@
<div
v-if=
"item.componentCode == 'wo-timeout' && item.componentInfo.visible == 1"
>
<wo-timeout
:datas=
"item"
></wo-timeout>
</div>
<!--
<div
v-if=
"item.componentCode == 'custom-list' && item.componentInfo.visible == 1"
>
<custom-list
:datas=
"item"
></custom-list>
</div>
-->
</div>
<bottomCont></bottomCont>
...
...
@@ -145,6 +148,7 @@ import birth from '@/api/popup'
import
couponPopup
from
'@/components/couponPopup.vue'
import
NewUser
from
"../../components/newCustomer/newUser"
;
import
NewPolite
from
"../../components/newCustomer/newPolite"
;
import
customList
from
"../../components/custom-list"
;
import
{
setTabBarActive
,
checkTabbarPage
,
themeColor
,
checkShowConditionIds
}
from
"../../utils/mayi.js"
;
import
indexApi
from
"@/api/index.js"
;
import
{
throttle
,
concatUrl
}
from
"../../utils/index.js"
...
...
@@ -200,7 +204,8 @@ export default {
NewPolite
,
birthPopup
,
mpvueCropper
,
woTimeout
woTimeout
,
'custom-list'
:
customList
},
onShareAppMessage
(
res
)
{
let
{
shopCode
}
=
app
.
globalData
.
shopInfo
;
...
...
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