amis2/examples/components/Carousel.jsx

91 lines
2.5 KiB
React
Raw Normal View History

2019-05-16 16:31:20 +08:00
export default {
type: 'page',
title: '轮播图',
2019-11-07 10:41:14 +08:00
data: {
carousel0: [
'https://hiphotos.baidu.com/fex/%70%69%63/item/bd3eb13533fa828b13b24500f31f4134960a5a44.jpg',
'https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png',
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg'
2019-11-07 10:41:14 +08:00
],
carousel1: [
{
html:
'<div style="width: 100%; height: 300px; background: #e3e3e3; text-align: center; line-height: 300px;">carousel data in form</div>'
},
{
image:
'https://hiphotos.baidu.com/fex/%70%69%63/item/bd3eb13533fa828b13b24500f31f4134960a5a44.jpg'
2019-11-07 10:41:14 +08:00
},
{
image:
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg'
2019-11-07 10:41:14 +08:00
}
]
},
body: [
{
type: 'grid',
2019-11-07 10:41:14 +08:00
columns: [
2019-05-16 16:31:20 +08:00
{
type: 'panel',
title: '直接页面配置',
2019-11-07 10:41:14 +08:00
body: {
type: 'carousel',
controlsTheme: 'light',
height: '300',
2019-11-07 10:41:14 +08:00
options: [
{
2019-12-24 11:25:55 +08:00
image:
'https://internal-amis-res.cdn.bcebos.com/images/2019-12/1577157239810/da6376bf988c.png'
2019-11-07 10:41:14 +08:00
},
{
html:
'<div style="width: 100%; height: 300px; background: #e3e3e3; text-align: center; line-height: 300px;">carousel data</div>'
},
{
image:
'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3893101144,2877209892&fm=23&gp=0.jpg'
2019-11-07 10:41:14 +08:00
}
2019-06-14 11:16:06 +08:00
]
2019-11-07 10:41:14 +08:00
}
2019-06-14 11:16:06 +08:00
},
{
type: 'panel',
title: '使用itemSchema配置',
2019-11-07 10:41:14 +08:00
body: {
type: 'carousel',
name: 'carousel0',
controlsTheme: 'dark',
height: '300',
2019-11-07 10:41:14 +08:00
itemSchema: {
type: 'tpl',
2019-11-07 10:41:14 +08:00
tpl:
'<div style="height: 100%; background-image: url(<%=data.item%>); background-position: center center; background-size: cover;"></div>'
}
}
2019-05-16 16:31:20 +08:00
}
2019-11-07 10:41:14 +08:00
]
},
{
type: 'grid',
2019-11-07 10:41:14 +08:00
columns: [
{
type: 'form',
title: '表单内展示',
2019-11-07 10:41:14 +08:00
sm: 6,
controls: [
{
type: 'carousel',
controlsTheme: 'dark',
name: 'carousel1',
label: 'carousel',
animation: 'slide',
height: '300'
2019-11-07 10:41:14 +08:00
}
]
}
]
}
]
};