提交 911bcb59 编写于 作者: W wanganxp

把draw的示例从view挪到了api的界面分类下

上级 67df3c70
...@@ -14,12 +14,6 @@ ...@@ -14,12 +14,6 @@
"navigationBarTitleText": "view" "navigationBarTitleText": "view"
} }
}, },
{
"path": "pages/component/view/view-draw",
"style": {
"navigationBarTitleText": "DrawableContext"
}
},
{ {
"path": "pages/component/scroll-view/scroll-view", "path": "pages/component/scroll-view/scroll-view",
"style": { "style": {
...@@ -970,7 +964,15 @@ ...@@ -970,7 +964,15 @@
"path" : "pages/API/element-takesnapshot/element-takesnapshot", "path" : "pages/API/element-takesnapshot/element-takesnapshot",
"style" : "style" :
{ {
"navigationBarTitleText" : "", "navigationBarTitleText" : "takeSnapshot",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/API/element-draw/element-draw",
"style" :
{
"navigationBarTitleText" : "getDrawableContext",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
} }
......
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
<scroll-view style="flex: 1"> <scroll-view style="flex: 1">
<!-- #endif --> <!-- #endif -->
<view> <view>
<view ref="draw-text-view" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-text-view" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-line-view" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-line-view" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-circle-view" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-circle-view" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-dash-line" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-dash-line" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-house" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-house" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-style" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-style" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-odd" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-odd" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
<view ref="draw-arcto" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view> <view id="draw-arcto" style="width: 750rpx;height: 550rpx; background-color: lightgray;margin: 30rpx 0rpx;"></view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
...@@ -57,8 +57,8 @@ ...@@ -57,8 +57,8 @@
}, },
methods: { methods: {
drawText() { drawText() {
let element = (this.$refs['draw-text-view'] as Element) let element = uni.getElementById('draw-text-view')
let ctx = element.getDrawableContext() let ctx = element!.getDrawableContext()
let width = element.getBoundingClientRect().width let width = element.getBoundingClientRect().width
ctx!!.reset() ctx!!.reset()
ctx!!.font = "15px" ctx!!.font = "15px"
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
ctx!!.update() ctx!!.update()
}, },
drawLines() { drawLines() {
let ctx = (this.$refs['draw-line-view'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-line-view')!.getDrawableContext()
ctx!!.reset() ctx!!.reset()
ctx!!.lineWidth = 10; ctx!!.lineWidth = 10;
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
y += 15; y += 15;
}, },
drawCircles() { drawCircles() {
let ctx = (this.$refs['draw-circle-view'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-circle-view')!.getDrawableContext()
ctx!!.reset() ctx!!.reset()
// Draw shapes // Draw shapes
for (var i = 0; i < 4; i++) { for (var i = 0; i < 4; i++) {
...@@ -155,7 +155,7 @@ ...@@ -155,7 +155,7 @@
}, },
drawStar() { drawStar() {
let ctx = (this.$refs['draw-dash-line'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-dash-line')!.getDrawableContext()
ctx!!.reset() ctx!!.reset()
ctx!!.beginPath(); ctx!!.beginPath();
var horn = 5; // 画5个角 var horn = 5; // 画5个角
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
return result return result
}, },
drawhouse() { drawhouse() {
let ctx = (this.$refs['draw-house'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-house')!.getDrawableContext()
ctx!!.reset() ctx!!.reset()
ctx!!.lineWidth = 10; ctx!!.lineWidth = 10;
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
ctx!!.update() ctx!!.update()
}, },
drawPoint() { drawPoint() {
let ctx = (this.$refs['draw-style'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-style')!.getDrawableContext()
ctx!!.reset() ctx!!.reset()
for (let i = 0; i < 6; i++) { for (let i = 0; i < 6; i++) {
for (let j = 0; j < 6; j++) { for (let j = 0; j < 6; j++) {
...@@ -265,7 +265,7 @@ ...@@ -265,7 +265,7 @@
ctx!!.update() ctx!!.update()
}, },
drawRect() { drawRect() {
let ctx = (this.$refs['draw-odd'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-odd')!.getDrawableContext()
ctx!!.reset() ctx!!.reset()
// Create path // Create path
ctx!!.moveTo(30, 90); ctx!!.moveTo(30, 90);
...@@ -283,7 +283,7 @@ ...@@ -283,7 +283,7 @@
}, },
drawArcTo() { drawArcTo() {
let ctx = (this.$refs['draw-arcto'] as Element).getDrawableContext() let ctx = uni.getElementById('draw-arcto')!.getDrawableContext()
ctx!.reset() ctx!.reset()
ctx!.beginPath(); ctx!.beginPath();
ctx!.moveTo(50, 20); ctx!.moveTo(50, 20);
......
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
<boolean-data :defaultValue="false" title="是否阻止本节点的祖先节点出现点击态" @change="change_stop_propagation_boolean"></boolean-data> <boolean-data :defaultValue="false" title="是否阻止本节点的祖先节点出现点击态" @change="change_stop_propagation_boolean"></boolean-data>
<enum-data :items="start_time_enum" title="按住后多久出现点击态" @change="radio_change_start_time_enum"></enum-data> <enum-data :items="start_time_enum" title="按住后多久出现点击态" @change="radio_change_start_time_enum"></enum-data>
<enum-data :items="stay_time_enum" title="手指松开后点击态保留时间" @change="radio_change_stay_time_enum"></enum-data> <enum-data :items="stay_time_enum" title="手指松开后点击态保留时间" @change="radio_change_stay_time_enum"></enum-data>
<view class="uni-padding-wrap uni-common-mt uni-common-mb">
<button class="uni-common-mt" @click="goGeneralAttribute('/pages/component/view/view-draw')">DrawableContext</button>
</view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
...@@ -46,11 +43,6 @@ export default { ...@@ -46,11 +43,6 @@ export default {
radio_change_stay_time_enum(time : number) { radio_change_stay_time_enum(time : number) {
this.stay_time = time this.stay_time = time
}, },
goGeneralAttribute(path: string) {
uni.navigateTo({
url: path,
})
},
}, },
} }
</script> </script>
......
...@@ -148,9 +148,13 @@ ...@@ -148,9 +148,13 @@
api: ["getElementById"] api: ["getElementById"]
}, },
{ {
name: 'element draw',
url: 'element-draw',
api: ["Element.getDrawableContext"]
},{
name: 'element截图', name: 'element截图',
url: 'element-takesnapshot', url: 'element-takesnapshot',
api: ["takeSnapshot"] api: ["Element.takeSnapshot"]
}, },
{ {
name: 'node节点', name: 'node节点',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册