javascript - vuez父组件与子组件的动态传递问题?
PHP中文网
PHP中文网 2017-04-11 12:24:59
[JavaScript讨论组]

使用Element UI开发网站。在父组件中
html:

            
            

data:

cashboxsearch: [{

      CashboxId:'', //钱箱ID
      EventType: '车辆超速',
      VehicleId:'', //车辆ID
      PlateNumber: '京A888888',  
      StartTime:'2017-03-02 18:00:00',
      StartMessage:'车辆超速',
      EndTime:'2017-03-02 19:00:00',
      EndMessage:'车辆超速',
      Warn:true,
      StartLONG:'120.963107',
      StartLAT:'52.003703',
      EndLONG:'108.952807',
      EndLAT:'32.011273'
    },

使用Element ui 方法@row-click='handleRowHandle'

handleRowHandle(row){

        var startPoint = [];
        startPoint.push(row.StartLONG);
        startPoint.push(row.StartLAT);

        var endPoint = [];
        endPoint.push(row.EndLONG);
        endPoint.push(row.EndLAT);
        
        this.mapoint.length = 0;
        this.mapoint.push(startPoint);
        this.mapoint.push(endPoint);
       console.log(this.mapoint) 
     },
      可以获取经纬度值。
      
 在子组件  
 
 在子组件中 运行mounted函数时可以获取值。
 
   data:function(){
            return {
                positions:[],
            }
        },
        props:["childmapoint","childmodel"],
        mounted: function () { 
            console.log("jjjjjjj")
            console.log(this.childmapoint)
        //地图初始化  
        this.map = new AMap.Map(this.$el, {
            resizeEnable: true,
            zoom: 12,
        })
    //    this.positions = [[118.915171,32.12761],[118.915171,32.12531]];
    
        this.positions = this.childmapoint;
        for(let i=0;i

   问题:如何让每次点击时都改变经纬度值?        
PHP中文网
PHP中文网

认证0级讲师

全部回复(1)
天蓬老师

watch监听这个值

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号