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

做标书的视频网站专门下软件的app

做标书的视频网站,专门下软件的app,想做国外的客户做网站怎么弄,无忧网站watch是vue内部提供的一个用于侦听功能的更通用的方法#xff0c;其用来响应数据的变化#xff0c;通过特定的数据变化驱动一些操作。简言之#xff1a;当需要被watch监听的数据发生变化时就会被执行watch中的逻辑。实现数据的实时更新#xff01; 普通监听 template…watch是vue内部提供的一个用于侦听功能的更通用的方法其用来响应数据的变化通过特定的数据变化驱动一些操作。简言之当需要被watch监听的数据发生变化时就会被执行watch中的逻辑。实现数据的实时更新 普通监听 templatediv/div /template scriptexport default {data(){variable:null,},watch:{// 此处监听variable变量variable的值变化就会执行以下variable变量后的方法体variable(val){// 变化后需要执行的逻辑}}} /script如上当监听到变量variable产生变化时会被页面侦听到并执行相应的的逻辑。在实际开发中所有需要被监听的变量都需要写在watch中这样可在监听到变量发生变化时执行相应的逻辑。 深度监听deep 普通变量的变化的侦听是使用以上方法当所需侦听的变量是对象时则不起作用这时就需要使用deep属性进行深度监听。如下所示 templatediv/div /template scriptexport default {data(){myObject:{value:},},watch:{myObject:{// 此处监听myObject属性value变量handler(val){},deep:true}}}/script案例 先上代码 export default {props: {//prop定义要求使用该组件时需要绑定bar-chart进行传值barDataChart:{type: Object,required: true}},data() {return {chart: null}},//监听barChart中值的变化watch:{barDataChart:{deep:true,handler(val){this.setOptions(val)}}},mounted() {this.$nextTick(() {this.initChart()})},beforeDestroy() {if (!this.chart) {return}this.chart.dispose()this.chart null},methods: {initChart() {this.chart echarts.init(this.$el, macarons)this.setOptions(this.barDataChart)},setOptions({work_days, hj_main_count, hj_right_count, hj_left_count, hj_main, hj_right, hj_left}) {this.chart.setOption({tooltip: {trigger: axis,axisPointer: { // 坐标轴指示器坐标轴触发有效type: shadow // 默认为直线可选为line | shadow}},grid: {top: 10,left: 2%,right: 2%,bottom: 3%,containLabel: true},xAxis: [{type: category,data: work_days,// name:日期,nameLocation: middle, // 显示位置nameTextStyle: {fontWeight: bold // 字体加粗},axisTick: {alignWithLabel: true}}],yAxis: [{type: value,axisTick: {show: false},// 设置轴单位显示格式---------------axisLabel: {formatter: {value} 次}}],series: [{name: hj_main,type: bar,stack: vistors,barWidth: 60%,data: hj_main_count,animationDuration,itemStyle: { // 设置折线图样式color: #FFA500 // 设置折线的颜色为橙色}}, {name: hj_right,type: bar,stack: vistors,barWidth: 60%,data: hj_right_count,animationDuration,itemStyle: { // 设置折线图样式color: #CD5C5C // 设置折线的颜色为橙色}}, {name: hj_left,type: bar,stack: vistors,barWidth: 60%,data: hj_left_count,animationDuration}]})}} } /scriptbarDataChart是一个 props 属性它通过组件的父组件传递进来并且是一个对象类型。当 chartData 发生变化时watch 监听器会自动执行其中定义的逻辑。 barDataChart:{type: Object,required: true} 在watch中深度监听barChart中值的变化,当barDataChart值发生变化时执行this.setOptions方法并将val值作为参数传入。 //监听barChart中值的变化watch:{barDataChart:{deep:true,handler(val){this.setOptions(val)}}}, 在如上的监听器中我们设置了 deep: true 选项表示要深度监听 chartData 对象的变化。也就是说当 chartData 内部的属性发生改变时监听器也会触发。其中handler 是监听器的回调函数它接收一个参数 val表示 chartData 的新值。在这个回调函数中当监听到数据变化时我们要执行了组件的 setOptions 方法并将 chartData 的新值作为参数传递进去。 附完整代码 templatediv :classclassName :style{height:height,width:width} / /templatescript import * as echarts from echarts; require(echarts/theme/macarons) // echarts theme import resize from ./mixins/resizeconst animationDuration 6000export default {mixins: [resize],props: {className: {type: String,default: chart},width: {type: String,default: 100%},height: {type: String,default: 300px},//prop定义要求使用该组件时需要绑定bar-chart进行传值barDataChart:{type: Object,required: true}},data() {return {chart: null}},//监听barChart中值的变化watch:{barDataChart:{deep:true,handler(val){this.setOptions(val)}}},mounted() {this.$nextTick(() {this.initChart()})},beforeDestroy() {if (!this.chart) {return}this.chart.dispose()this.chart null},methods: {initChart() {this.chart echarts.init(this.$el, macarons)this.setOptions(this.barDataChart)},setOptions({work_days, hj_main_count, hj_right_count, hj_left_count, hj_main, hj_right, hj_left}) {this.chart.setOption({tooltip: {trigger: axis,axisPointer: { // 坐标轴指示器坐标轴触发有效type: shadow // 默认为直线可选为line | shadow}},grid: {top: 10,left: 2%,right: 2%,bottom: 3%,containLabel: true},xAxis: [{type: category,data: work_days,// name:日期,nameLocation: middle, // 显示位置nameTextStyle: {fontWeight: bold // 字体加粗},axisTick: {alignWithLabel: true}}],yAxis: [{type: value,axisTick: {show: false},// 设置轴单位显示格式---------------axisLabel: {formatter: {value} 次}}],series: [{name: hj_main,type: bar,stack: vistors,barWidth: 60%,data: hj_main_count,animationDuration,itemStyle: { // 设置折线图样式color: #FFA500 // 设置折线的颜色为橙色}}, {name: hj_right,type: bar,stack: vistors,barWidth: 60%,data: hj_right_count,animationDuration,itemStyle: { // 设置折线图样式color: #CD5C5C // 设置折线的颜色为橙色}}, {name: hj_left,type: bar,stack: vistors,barWidth: 60%,data: hj_left_count,animationDuration}]})}} } /script
http://www.dnsts.com.cn/news/16803.html

相关文章:

  • wordpress网站go.php跳转专门做视频的网站吗
  • 怎么用ip做网站网站系统改教程
  • 想要黑掉一个网站 要怎么做百度竞价推广收费
  • 黄页网站推广广告设计与制作专业能考二建吗
  • 网站后台程序网络营销外包好处
  • 营销型网站单页面如何查询网站点击量
  • 装修平台网站排名前十名无锡电商网站设计
  • 网站开发语言都有什么西双版纳傣族自治州属于哪个国家
  • 建设施工合同网站建手机网站的必要性
  • 阜蒙县建设学校官网网站软件开发app开发定制外包
  • 怎么做一个网站页面房价成交数据官网查询
  • 怎么利用网站做产品推广wordpress正文标题样式
  • 郑州市建设路第二小学网站wordpress怎么安装上服务器
  • 云系统网站建设合同广州个人网站制作公司
  • 上海网站建设报价单新化 网站开发
  • 怎么申请网站域名赚钱wordpress插件样式
  • 长春网站免费制作柳州seo公司
  • 如何建网站吗?计算机包含哪些专业
  • 石家庄网站建设方案网站为什么要维护
  • 网站做一个要多少钱有限责任公司怎么注册
  • 建设网站东莞公司网站建设厘金手指排名二二
  • aspcms手机网站源码网站域名备案
  • 外贸正品网站一键分享到wordpress
  • 软件企业公司网站模板下载做高端生活方式的网站
  • asp网站开发 基础北京做网站的公司商集客电话
  • 装修公司经营范围网站后台管理优化
  • 营销型网站建设实战感想廊坊网站建站网站
  • 做教育招生网站软件界面设计的基本原则
  • 网站案例欣赏免费引流人脉推广软件
  • 科研平台网站建设计划广告公司会建设网站吗