当前位置: 首页 > news >正文

wordpress预约天津海外seo

wordpress预约,天津海外seo,申请域名之后如何做网站,南阳响应式网站web-view 需要用到 web-view ,类似于iframe, 将网页嵌套到微信小程序中,参数传递等; 示例(无法实时传递数据),页面销毁时才能拿到h5传递的数据,只能利用这点点击跳转到小程序另一个…

web-view

需要用到 web-view ,类似于iframe, 将网页嵌套到微信小程序中,参数传递等;

示例(无法实时传递数据),页面销毁时才能拿到h5传递的数据,只能利用这点点击跳转到小程序另一个页面获取数据

H5

wx.miniProgram.postMessage({data: { url }
})

uniapp

<web-view src="http://localhost:8080" @message="getMessage"></web-view>getMessage(e) {console.log(e.detail.data[0].url)
}

实战

1.h5页面

新建项目或现有项目(可访问,可联通的)新开页面html等

 <template><div><button @click="saveImg">生成图片</button><el-table :data="tableData" style="width: 100%" id="container"><el-table-columnprop="date"label="日期"width="180"></el-table-column><el-table-columnprop="name"label="姓名"width="180"></el-table-column><el-table-columnprop="address"label="地址"></el-table-column></el-table></div>
</template><script>export default {data() {return {tableData: [{date: '2016-05-02',name: '王小虎',address: '上海市普陀区金沙江路 1518 弄'}, {date: '2016-05-04',name: '王小虎',address: '上海市普陀区金沙江路 1517 弄'}]}},methods: {saveImg() {const container = document.querySelector('#container ') // 获取包含需要保存为图片的元素的容器// 使用html2canvas将元素转换为canvashtml2canvas(container).then((canvas) => {// 将canvas转换为Blob对象canvas.toBlob((blob) => {const url = URL.createObjectURL(blob) // 生成临时网络路径wx.miniProgram.navigateTo({ // 跳转时销毁嵌套的h5页面,获取数据url: `/pages_sub/img?url=${url}` // 直接跳转到另一页面预览生成的图片})}, 'image/png')})}}}</script>

2.微信小程序(uniapp)

嵌套页面index.vue

<web-view src="http://localhost:8080"></web-view>

图片展示页面pages_sub/img

<template><view class="img_page"><view class="text-right pr-2 height-2"><u-button @click="downloadImage" type="primary" size="mini">保存图片</u-button></view><image :src="`${imgUrl}?t=${Math.random()}`"></image></view>
</template>
<script>
export default {data() {return {imgUrl: '',timer: null}},onLoad: function (options) {const url = options ? options.url : ''this.imgUrl = url.slice(5, url.length}destroyed() {if (this.timer) {clearTimeout(this.timer)this.timer = null}},methods: {downloadImage() {let that = this// 清除上一次的定时器if (this.timer) {clearTimeout(this.timer)}// 设置新的定时器this.timer = setTimeout(function () {// 显示加载提示wx.showToast({title: '下载中...',icon: 'loading'})let link = that.imgUrl // 获取图片URL// 下载文件wx.downloadFile({url: link,success(res) {if (res.statusCode === 200) {const filePath = res.tempFilePath // 获取图片临时文件路径// 检查权限wx.getSetting({success(res) {if (!res.authSetting['scope.writePhotosAlbum']) {// 请求授权wx.authorize({scope: 'scope.writePhotosAlbum',success() {that.saveImage(filePath) // 保存图片},fail() {// 引导用户开启授权wx.showModal({title: '提示',content:'您已拒绝我们保存图片到相册,您可以在设置中开启',success(res) {if (res.confirm) {wx.openSetting({success(res) {console.log(res.authSetting)}})}}})}})} else {that.saveImage(filePath) // 保存图片}}})}},fail() {wx.showToast({// 添加失败提示框title: '下载失败',icon: 'none',duration: 2000})}})}, 1000) // 1000 毫秒的延迟},// 保存图片saveImage(filePath) {// 保存图片到系统相册wx.saveImageToPhotosAlbum({filePath: filePath,success(res) {wx.showToast({// 添加成功提示框title: '保存图片成功',icon: 'success',duration: 2000})},fail() {wx.showToast({// 添加失败提示框title: '保存图片失败',icon: 'none',duration: 2000})}})}}
}
</script>

3. 但此时的图片应该是展示不出来,小程序支持https路径的文件,可以在生成图片时调取接口存起来,在小程序跳转时再通过接口获取https图片,即可

http://www.hkea.cn/news/385163/

相关文章:

  • 做盗版影视网站如何给公司网站做推广
  • 做网站付费流程郑州seo技术
  • 云南网站开发有哪些实用的网络推广方法
  • 央视新闻最新消息今天什么叫seo
  • 网站建设的意义徐州百度推广
  • 建设网站建设的目标百度云盘资源
  • 个体工商户是否能够做网站在线生成个人网站源码
  • 临沂高端网站建设厦门网站推广费用
  • 网站模版友链交易交易平台
  • 武汉做网站找谁百度导航是哪个国家的
  • wordpress互动游戏黄石seo诊断
  • 网页设计作品下载志鸿优化设计
  • 宾馆网站制作seminar是什么意思
  • 网站建设的进度表爱站查询工具
  • 深圳聘请做网站人员长春刚刚最新消息今天
  • 汽配人网做网站沈阳网站seo公司
  • 网站 短链接怎么做网站建设网站定制
  • 网站开发凭证做什么科目百度推广关键词多少合适
  • 网站正在建设 h5模板新闻热点
  • 龙岗公司网站建设怎么上百度搜索
  • 七米网站建设网站自动推广软件免费
  • 余姚公司做网站跨境电商怎么做
  • 顺义哪有做网站厂家百度快照在哪里找
  • 深圳南山网站建设重庆seo黄智
  • 教育微网站建设我要学电脑哪里有短期培训班
  • 民宿预订网站制作推广方案怎么做
  • 做网站都要掌握什么网页模版
  • 网站怎么做qq微信登陆长沙优化网站哪家公司好
  • 为什么上不了建设银行个人网站漳州网络推广
  • 天津手机网站建站培训代运营公司可靠吗