识别json路径的模板,公共方法

此博客介绍了如何使用Vue.js动态创建时间相关的div元素,展示了两种不同高度的气象图像:一种是常规的Radar图像,另一种是3D_MOC产品,提供定制高度选项。通过`timeComponent`函数,展示了世界时、北京时和最近6分钟的时间处理,并提供了历史规则链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

timeComponent(url, date, height) {
  let ele = document.createElement("div");
  ele.id = "ele"
  let content = new Vue({
     data() {
        return {
             time: date, // 北京时
             UTCtime: new Date(date.getTime() - 8 * 3600000), // 世界时
             specialtime: new Date(date.getTime() - (date.getMinutes() - 
                   parseInt(date.getMinutes() / 6) * 6) * 60000), //当前时间最近的6分钟
             height: height // 高空产品,有高度选择项
           };
          },
          template: "<div>" + url + "</div>"
        }).$mount('#ele')
        return content.$el.innerHTML.trim()
    }

普通模板

 "image": {
     "url": "radar_image_mercator/WPPP_PP_{{time.format('yyyyMMdd_hh0000')}}.png",
 "extent": [
        [12.2, 73.0],
        [54.2, 135.0]
],
"historyrules": "product/radar/mercator/PP/{{time.format('yyyy')}}/{{time.format('yyyyMMdd')}}/WPPP_PP_{{time.format('yyyyMMdd_hh0000')}}.png"
                },

 带有高度选择项

"image": {
  "url": "product_aws/MOC_3D_T_{{time.format('yyyyMMdd_hh0000')}}_{{height}}.png",
   "extent": [
              [8, 73.0],
              [62, 135.0]
              "historyrules": "product/laps/3D_T/{{time.format('yyyy')}}/{{time.format('yyyyMMdd')}}/MOC_3D_T_{{time.format('yyyyMMdd_hh0000')}}_{{height}}.png"
                                },

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值