提交 8e6663ea 编写于 作者: W wanganxp

更新截图示例;优化模板列表到详情的吸顶样式

上级 4a42819e
<template> <template>
<view> <view id="snapshot-content">
<page-head id="page-head" title="getElementById"></page-head> <page-head id="page-head" title="对本页面根view截图"></page-head>
<view class="uni-padding-wrap" id="snapshot-content"> <view class="uni-padding-wrap">
<text id="text">this is text</text> <text id="text">this is text</text>
<view id="view" class="uni-common-mt" style="border: 1px solid red">this is view</view>
</view> </view>
<button class="uni-btn" @click="changeViewStyle">
修改 view 宽高及背景色
</button>
<button class="uni-btn btn-TakeSnapshot" type="primary" @tap="takeSnapshotClick"> <button class="uni-btn btn-TakeSnapshot" type="primary" @tap="takeSnapshotClick">
点击截图 点击截图并替换显示下方图片
</button> </button>
<image style="margin-top: 20px;" :src="snapImage" mode="aspectFit" @longpress="saveToAlbum"></image> <image style="margin-top: 20px;" :src="snapImage" mode="aspectFit" @longpress="saveToAlbum"></image>
</view> </view>
...@@ -24,16 +19,6 @@ ...@@ -24,16 +19,6 @@
} }
}, },
methods: { methods: {
changeViewStyle() {
const text = uni.getElementById('text')!
text.style.setProperty('color', 'red')
const view = uni.getElementById('view')!
view.style.setProperty('width', '90%')
view.style.setProperty('height', '50px')
view.style.setProperty('backgroundColor', '#007AFF')
},
takeSnapshotClick() { takeSnapshotClick() {
const view = uni.getElementById('snapshot-content')! const view = uni.getElementById('snapshot-content')!
view.takeSnapshot({ view.takeSnapshot({
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
</list-item> </list-item>
<sticky-header> <sticky-header>
<view style="width: 100%;height:44px;background-color: #f5f5f5;flex-direction: row;justify-content:center;align-items:center;"> <view style="width: 100%;height:44px;background-color: #f5f5f5;flex-direction: row;justify-content:center;align-items:center;">
<button style="height: 40px;font-size: 13px;" v-for="(name,index) in th_item" @click="clickTH(index)"> <text v-for="(name,index) in th_item" @click="clickTH(index)" style="margin-right: 20px;">
{{name}} {{name}}
</button> </text>
</view> </view>
</sticky-header> </sticky-header>
<list-item v-for="(value, index) in listData" :key="index"> <list-item v-for="(value, index) in listData" :key="index">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册