在vue-cli項目中使用第三方的js,不是es6格式


在index.html中引入js

在main.js使用

const JTopo=window.JTopo;
Vue.prototype.JTopo=JTopo;

在組件中使用

 let stage = new this.JTopo.Stage(canvas);
       console.log(stage)
      // stage.eagleEye.visible = true;
      //stage.wheelZoom = 1.2; //縮放比例
      var scene = new this.JTopo.Scene( this.JTopo.stage); 
     var defaultNode = new this.JTopo.Node();
      defaultNode.text = '微軟雅黑'; // 文字
      defaultNode.textPosition = 'Middle_Center';// 文字居中
      defaultNode.textOffsetY = 8; // 文字向下偏移8個像素
      defaultNode.font = '14px 微軟雅黑'; // 字體
      defaultNode.setLocation(180, 100); // 位置
      defaultNode.setSize(100, 60);  // 尺寸
      defaultNode.borderRadius = 5; // 圓角
      defaultNode.borderWidth = 2; // 邊框的寬度
      defaultNode.borderColor = '255,255,255'; //邊框顏色            
      defaultNode.alpha = 0.7; //透明度
      
      scene.add(defaultNode);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM