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

嘉兴疫情最新消息情况封控区域谈谈你对seo概念的理解

嘉兴疫情最新消息情况封控区域,谈谈你对seo概念的理解,全免费云游戏网页在线玩,wordpress熊掌号提交数据效果图如下: 思路: 1.首先我想到的就是使用图标库echarts或ucharts,可是找了找没有找到类似的。 2.其次我就想用画布来实现这个效果,直接上手。(app-vue和小程序均可以实现,但是在app-nvue页面不支持画布…

效果图如下:

思路:

1.首先我想到的就是使用图标库echarts或ucharts,可是找了找没有找到类似的。

2.其次我就想用画布来实现这个效果,直接上手。(app-vue和小程序均可以实现,但是在app-nvue页面不支持画布,尝试了一下再nvue页面直接导致程序闪退)

3.后来,使用手动创建一个竖向的类似效果。

注意:

1.app-nvue页面不支持画布效果,官方说引入插件支持,但直接导致闪退。

2.map很多参数app端仅支持app-nvue页面。

方法一 使用画布进行绘制(不支持app-nvue)

<template><view class="container"><canvas :canvas-id="canvasId" style="width: 300px; height: 300px;"></canvas></view>
</template><script>export default {data() {return {canvasId: "canvas",pollutionLevels: [{level: "优",color: "#00FF00",percent: 0.133,mark: "35"},{level: "良",color: "#FFFF00",percent: 0.133,mark: "75"},{level: "轻度",color: "#ff5500",percent: 0.133,mark: "115"},{level: "中度",color: "#FF0000",percent: 0.133,mark: "150"},{level: "重度",color: "#860000",percent: 0.133,mark: "250"},{level: "严重",color: "#510000",percent: 0.133,mark: "500"}]};},mounted() {this.drawChart();},methods: {drawChart() {const ctx = uni.createCanvasContext(this.canvasId, this);const startX = 0; // 图表起始位置X坐标const startY = 20; // 图表起始位置Y坐标const chartWidth = 260; // 图表宽度const chartHeight = 10; // 图表高度const textHeight = 20; // 标题高度const markfontSize = 10; //标点信息字体大小const fideWeight = 10 //减去范围坐标点的宽度const fideHeight = 44 //加上范围坐标点的高度const tdPaddingHeight = 4 //垂直距离高度let x = startX;const y = startY;let nextX = 0; // 下一个起始位置的x坐标function drawColorBlock(color, width, height) {ctx.setFillStyle(color);ctx.fillRect(x, y, width, height);}function drawText(text, width) {ctx.setFontSize(markfontSize);ctx.setFillStyle("#000000");const textWidth = ctx.measureText(text).width; // 计算文字宽度const textX = x + (width - textWidth) / 2; // 水平居中对齐ctx.fillText(text, textX, y - chartHeight + tdPaddingHeight); //在图表的上方}function drawMarkText(text) {ctx.setFontSize(markfontSize);ctx.setFillStyle("#000000");const textWidth = ctx.measureText(text).width; // 计算文字宽度const textX = startX + nextX - fideWeight - textWidth / 2; // 水平居中对齐if (text === "0") {ctx.fillText("0", startX, y - textHeight + fideHeight);} else {ctx.fillText(text, textX + 10, y - textHeight + fideHeight);}}this.pollutionLevels.forEach(level => {const width = chartWidth * level.percent;nextX = x + width; // 记录下一个起始位置的x坐标// 绘制颜色区块drawColorBlock(level.color, width, chartHeight);// 绘制标题drawText(level.level, width);drawMarkText(level.mark);if (level.level==='优') {drawMarkText("0");drawMarkText(level.mark);}x = nextX; // 更新起始位置的x坐标});ctx.draw();}}}
</script>

实现效果图如下

方法二 使用盒子创建竖向对应(比较笨拙,但是app-nvue页面只能这样来实现了)

这里我封装了一个方法

组件代码

<template><view class="legend-section"><view class="rowlist" v-for="(item,index) in list" :key="index"><view class="bgColor" :style="{'width':'50rpx','height':'20rpx','background-color':item.bgColor}"></view><view class="mark"><text style="font-size: 22rpx;">{{item.mark}}</text></view></view></view>
</template><script>export default {props: {legendList: {type: [Array],default: () => []},},data() {return {list: []}},watch: {legendList: {handler: function(newVal) {const datas = JSON.parse(newVal)datas.forEach((ele) => {if (ele.mark === '优') {ele.bgColor = "#00FF00"} else if (ele.mark === '良') {ele.bgColor = "#FFFF00"} else if (ele.mark === '轻度') {ele.bgColor = "#ff5500"} else if (ele.mark === '中度') {ele.bgColor = "#FF0000"} else if (ele.mark === '重度') {ele.bgColor = "#860000"} else if (ele.mark === '严重') {ele.bgColor = "#510000"} else if (ele.mark === '离线') {ele.bgColor = "#818181"} })this.list = datas},deep: true, // 深度监听immediate: true // 立即执行}},}
</script><style lang="scss" scoped>.legend-section {border-radius: 2rpx;padding: 10rpx;}.rowlist {display: flex;flex-flow: row nowrap;align-items: center;justify-content: flex-start;margin: 10rpx 12rpx;}.mark {padding-left: 10rpx;}
</style>

调用组件

	<cover-view class="maplegend-list" v-if="legendFlag"><legend :legend-list="legendList"></legend></cover-view>//数据初始化legendList: [], //图例信息//传入数据this.legendList = JSON.stringify(legendList.data) //图例信息  

实现效果如下

总而言之,app-nvue页面有很大的性能提升,但总会牺牲一些东西来弥补。app-nvue页面css很多有局限性,仔细阅读文档。

http://www.mmbaike.com/news/108096.html

相关文章:

  • 中国最好的网站建设百度电商广告代运营
  • 国外网站推广宣传域名权重
  • 如何做自助搜券网站个人怎么注册自己的网站
  • 网站打不开原因海淀区seo多少钱
  • 新网站在谷歌上面怎么做推广seo教程免费
  • 成都互联网外包公司关键词优化流程
  • 旅游网站开发的流程总裁培训班
  • 美国人做网站用的是什么字体学设计什么培训机构好
  • 做外贸主要是哪些网站推广方案框架
  • 怎么做58网站吊车网百度推广充值必须5000吗
  • 网站测试流程今日头条荆州新闻
  • 能进封禁网站的手机浏览器vi设计
  • 广西做网站公司武汉seo网站管理
  • python做网站吗百度热线电话
  • 做公司网站首页长沙网站seo优化
  • 网站开发项目介绍ppt谷歌搜索引擎为什么国内用不了
  • 陕西做网站电话北京百度推广优化公司
  • 有免费做门户网站吗海会网络做的网站怎么做优化
  • 门户网站cms百度引擎入口
  • 与pos平台互补和集成的企业解决方案seo推广公司哪家好
  • 永兴网站开发举例一个成功的网络营销案例
  • 网站建设与管理基础如何做网址
  • 广州网站建设怎么做seo领导屋
  • WordPress网页自动重定向企业网站排名优化公司
  • 浙江省建设职业技术学院网站百度长尾关键词挖掘
  • 深圳住房建设局网站首页杭州seo优化
  • 做设计网站的工作怎么样上海seo推广公司
  • 怎么做网站封面上的图友情链接交易网
  • 永久免费网站建设百度搜索资源平台
  • 网站怎么进搜索推广是什么意思