3月20号快应用标准启动发布会后,这一新生技术瞬间火了。前端群里号召你们有兴趣的去调研下快应用,因而我用一天时间写了个京东金融快应用简易demo,接下来总结下遇到的一些问题和我的看法:javascript
图片来源:快应用发布会PPT
图片来源:快应用发布会PPT
css
"config": {
"designWidth":750
}
复制代码
less
和less-loader
依赖,style标签设置lang="less"
便可,业务逻辑写在script里。这里要强调一点的是,template里只能有一个根节点。"margin:0 auto;"
这类写法也不支持,官方文档说margin&padding属性值能够有1~4个值,但在实际使用时却不支持,上右下左4个值须要分开写。background
属性不支持url写法,要用背景图得用background-image
属性。须要强调的是,background
属性支持渐变样式,暂时不能与background-color
、background-image
同时使用。background-image
暂时不支持与background-color
,border-color
同时使用;不支持网络图片资源,支持本地图片资源。 背景颜色则要用background-color
去设置,颜色值也必须为6位的十六进制,如:"background-color:#ffffff;"
box-shadow
和font-family
属性暂时不支持;flex-start
|flex-end
|center
|space-between
,报错以下所示:
<template>
<!-- template里只能有一个根节点 -->
<div class="mainWrapper">
<div class="topPart">
<div class="topBg"></div>
<div class="slogan_title">
<image class="slogan" src="./../Images/slogan@3x.png"></image>
<image class="title" src="./../Images/logo.png"></image>
</div>
<div class="menu_icons">
<div class="menu" for="{{menuList}}" onclick="routeDetail($idx+1)">
<div class="icon">
<image src={{$item.icon}}></image>
</div>
<div>
<text class="name">{{$item.name}}</text>
</div>
</div>
</div>
</div>
<div class="contentPart" onclick="routeDetail(7)">
<div class="articleWrap" for="{{articleList}}">
<div>
<text class="title">{{$item.title}}</text>
</div>
<div>
<image class="thumbnail" src={{$item.img}}></image>
</div>
<div>
<text class="brief">{{$item.brief}}</text>
</div>
<div class="readAll">
<div>
<text class="tip">阅读全文</text>
</div>
<div>
<text class="arrow">></text>
</div>
</div>
</div>
</div>
<image class="bottomPart" src="./../Images/logo_grey@3X.png"></image>
</div>
</template>
复制代码
<style lang="less">
.mainWrapper{
flex-direction: column;
justify-content:flex-start;
background-color:rgba(84,95,113,0.10);
.topPart{
flex-direction: column;
justify-content:flex-start;
.topBg{
width:750px;
height:326px;
background-image:url('./../Images/index_top_bg@3x.png');
background-size:cover;
}
.slogan_title{
justify-content:space-between;
margin-left:40px;
margin-top:-263px;
width:680px;
.slogan{
width:381px;
height:52px;
}
.title{
width:66px;
height:66px;
margin-left:233px;
border-radius:50px;
}
}
.menu_icons{
width:710px;
height:220px;
background-color:#ffffff;
margin-left:20px;
margin-top:40px;
border-radius:6px;
justify-content:space-between;
align-items:center;
.menu{
width:138px;
display:flex;
flex-direction:column;
justify-content:space-between;
align-items:center;
margin-left:10px;
margin-top:48px;
margin-bottom:54px;
.icon{
width:64px;
height:64px;
}
div>.name{
font-size:24px;
line-height:34px;
color:#666666;
margin-top:20px;
}
}
}
}
.contentPart{
margin-top:40px;
margin-left:20px;
margin-right:20px;
flex-direction:column;
justify-content:flex-start;
.articleWrap{
width:710px;
background-color:#ffffff;
border-radius:6px;
flex-direction:column;
justify-content:flex-start;
padding-left:30px;
padding-right:30px;
margin-bottom:40px;
.title{
padding-top:33px;
padding-bottom:33px;
font-size:32px;
color:#333333;
font-weight:bold;
}
.thumbnail{
width:650px;
}
.brief{
padding-top:30px;
padding-bottom:30px;
font-size:28px;
color:#999999;
line-height:32px;
}
.readAll{
justify-content:space-between;
align-items:center;
border-top-width:0.5px;
border-top-color:#eeeeee;
padding-top:20px;
padding-bottom:20px;
.tip{
color:#333333;
font-size:28px;
}
.arrow{
color:#cccccc;
font-size:28px;
}
}
}
}
.bottomPart{
width:180px;
height:54px;
margin-top:20px;
margin-left:284px;
margin-bottom:30px;
}
}
</style>
复制代码
<script>
import router from '@system.router'
export default {
data: {
title: '京东金融',
menuList:[{
icon:'./../Images/index_icon_asset@3x.png',
name:'资产'
},{
icon:'./../Images/index_icon_profit@3x.png',
name:'查收益'
},{
icon:'./../Images/index_icon_quota@3x.png',
name:'查额度'
},{
icon:'./../Images/index_icon_bill@3x.png',
name:'查帐单'
},{
icon:'./../Images/index_icon_credit@3x.png',
name:'信用'
}],
articleList:[{
title:'白条是什么?怎么申请?',
img:'./../Images/bottom-img02.png',
brief:'白条是京东金融推出的我的消费信贷产品,申请京东白条后,您可使用白条额度在京东商城消费,享受先消费、后付款服务,同时支持最高24期分期还款。'
},{
title:'京东金融的理财产品,收益怎么样?',
img:'./../Images/bottom-img01.png',
brief:'京东按期理财是京东金融推出的简单、安全的稳健型理财产品,多种按期理财产品的投资收益、投资时间一目了然。从投资历史来看,收益高且稳定,获得了众多好评。'
}]
},
routeDetail(id) {
let uri = ''
// 跳转到应用内的某个页面,router用法详见:文档->接口->页面路由
switch (id) {
case 1:
uri = '/Assets'
break;
case 2:
uri = '/Income'
break;
case 3:
uri = '/Quota'
break;
case 4:
uri = '/Bill'
break;
case 5:
uri = '/Credit'
break;
case 6:
uri = '/About'
break;
case 7:
uri = '/Detail'
break;
case 8:
uri = '/Test'
break;
default:
break;
}
router.push({
uri: uri
})
}
}
</script>
复制代码
图片来源:快应用发布会PPT
图片来源:快应用发布会PPT
图片来源:快应用发布会PPT