Skip to content

Commit

Permalink
feat: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Gitjinfeiyang committed Sep 6, 2020
1 parent 1dac23e commit d84d410
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 11 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"dependencies": {
"core-js": "^3.6.5",
"easy-canvas-layout": "0.0.1",
"easy-canvas-layout": "0.0.8",
"vue": "^2.6.11"
},
"devDependencies": {
Expand Down
Binary file added public/images/arrow-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 41 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div id="app">
<ec-canvas :width="300" :height="600">
<ec-canvas :width="300" :height="600" debug>
<ec-scroll-view :styles="{height:600}">

<ec-view :styles="styles.imageWrapper">
Expand All @@ -10,6 +10,40 @@
</ec-view>
</ec-view>

<ec-view :styles="{padding:[10,5,5,5],backgroundColor:'#F2F6FC'}">
<ec-view
:styles="{display:'inline-block',textAlign:'center',width:'25%',margin:5,}"
v-for="(item,index) in examples"
:key="index"
:on="{
click(e){
window.location.href = host + item.url
}
}">
<ec-view :styles="{textAlign:'center'}">
<ec-image :styles="{width:40,height:40,display:'inline-block',borderRadius:4}" mode="aspectFill" src="https://dss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1709216491,2536617744&fm=26&gp=0.jpg" />
</ec-view>
<ec-view :styles="{textAlign:'center'}">
<ec-text :styles="{fontSize:10,maxLine:1,color:'#333'}">{{item.title}}</ec-text>
</ec-view>
<ec-view v-if="item.tag"
:styles="{
position:'absolute',
right:0,
top:-4,
backgroundColor:'#f00',
color:'#fff',
textAlign:'center',
fontSize:8,
lineHeight:12,
padding:[0,4],
borderRadius:7
}">
<ec-text>{{item.tag}}</ec-text>
</ec-view>
</ec-view>
</ec-view>

<ec-view :styles="styles.itemWrapper"
v-for="(item,index) in examples"
:key="index"
Expand All @@ -19,7 +53,10 @@
}
}">
<ec-view :styles="styles.title">
<ec-text>{{item.title}}</ec-text>
<ec-view :styles="{flex:1}">
<ec-text>{{item.title}}</ec-text>
</ec-view>
<ec-image src="/images/arrow-right.png" :styles="{width:20}"></ec-image>
</ec-view>
<ec-view :styles="styles.desc">
<ec-text>{{item.desc}}</ec-text>
Expand Down Expand Up @@ -50,12 +87,12 @@ export default {
padding: 10,
marginBottom: 10,
},
title:{ color: '#333', fontSize: 18, fontWeight: 800 },
title:{ color: '#333', fontSize: 18, fontWeight: 800,display:'flex' },
desc: { color: '#999' }
},
examples : [
{ title: 'Basic', desc: '基本布局', url: 'basic.html' },
{ title: 'Basic', desc: '基本布局', url: 'basic.html',tag:'Hot' },
{ title: 'Event 事件', desc: '事件监听', url: 'event.html' },
{ title: 'Image 图片', desc: '图片缩放类型', url: 'image.html' },
{ title: 'Demo', desc: '展示了滚动、事件、flex布局、文本换行对齐等能力', url: 'test.html' },
Expand Down
Binary file added src/assets/images/arrow-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions src/components/canvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export default {
height:{
type:Number,
default:300
},
debug:{
type:Boolean,
default:false
}
},
data(){
Expand Down Expand Up @@ -61,7 +65,7 @@ export default {
this.layer = easyCanvas.createLayer(this.ctx,{
dpr,
width:w,
height:h,
height:h
})
},
Expand Down Expand Up @@ -107,13 +111,13 @@ function generate(node,c){
return c((h) => h(node.tag,{
styles:node.styles,
attrs:node.$attrs,
on:node.on
on:node.on || {}
},node.$el.innerText))
}else{
return c((h) => h(node.tag,{
styles:node.styles,
attrs:node.$attrs,
on:node.on
on:node.on || {}
},children))
}
}
Expand Down

0 comments on commit d84d410

Please sign in to comment.