• VUE前端问题


    一、图表内容不显示

    1. watch: {
    2. chartData3: {
    3. handler() {
    4. this.init();
    5. },
    6. },
    7. timeData3: {
    8. handler() {
    9. this.init();
    10. },
    11. },
    12. },

     添加上面代码可以动态监控数据,实现图表的展示。

    二、背景图片报错显示不出来

    解决方法:

    background: url(~@/assets/login/e.png)

    将引入改为 ~@方式引入即可
    ~@的意思: @是webpack设置的路径名,代表的是src目录,可以在build / webpack.base.conf.js更改设置

    三、轨迹不随地图缩放而缩放

    1. init() {
    2. this.olSource_line = new VectorSource();
    3. console.log("this.viewZoom1:", this.viewZoom);
    4. this.olLayer_line = new VectorLayer({
    5. source: this.olSource_line,
    6. style: (feature) => {
    7. console.log("this.viewZoom2:", this.viewZoom);
    8. let coords = feature.getGeometry().getCoordinates();
    9. return [
    10. new Style({
    11. stroke: new Stroke({
    12. color: this.style.line_stroke,
    13. width: this.viewZoom + 2,
    14. }),
    15. }),
    16. ...this.getPointsStyle(coords)
    17. ]
    18. },
    19. });
    20. this.olMap.addLayer(this.olLayer_line);
    21. }

    地图缩放时this.viewZoom1在改变,但是this.viewZoom2不变。

    解决方法: 

    添加监听函数监听数据变化

    1. init() {
    2. this.olSource_line = new VectorSource();
    3. this.olLayer_line = new VectorLayer({
    4. source: this.olSource_line,
    5. style: (feature) => {
    6. console.log("this.viewZoom:", this.viewZoom);
    7. let coords = feature.getGeometry().getCoordinates();
    8. return [
    9. new Style({
    10. stroke: new Stroke({
    11. color: this.style.line_stroke,
    12. width: this.viewZoom + 2,
    13. }),
    14. }),
    15. ...this.getPointsStyle(coords)
    16. ]
    17. },
    18. });
    19. this.olMap.addLayer(this.olLayer_line);
    20. // 添加地图缩放事件监听器
    21. this.olMap.on('moveend', () => {
    22. this.viewZoom = this.olMap.getView().getZoom();
    23. this.updateLineStyle(); // 更新轨迹线样式
    24. });
    25. }
    26. updateLineStyle() {
    27. // 在这里更新轨迹线的样式,可以根据新的 this.viewZoom 值进行相应的样式调整
    28. let styleFunction = (feature) => {
    29. let coords = feature.getGeometry().getCoordinates();
    30. console.log("this.viewZoom:", this.viewZoom);
    31. return [
    32. new Style({
    33. stroke: new Stroke({
    34. color: this.style.line_stroke,
    35. width: this.viewZoom + 2,
    36. }),
    37. }),
    38. ...this.getPointsStyle(coords)
    39. ];
    40. };
    41. this.olLayer_line.setStyle(styleFunction);
    42. }

  • 相关阅读:
    Go基础之变量和常量
    SAP MM 为UB类型的STO执行VL10B,报错-没有项目类别表存在(表T184L NL 0002 V)-之对策
    JVM-字节码
    2023-9-23 区间分组
    可编程的并行接口8255A
    allegro测量命令执行完之后显示如下图的问题是怎么回事
    如何做好医药产品说明书翻译?
    【CANN训练营】CANN:AICPU算子开发
    【Qt炫酷动画】1.easing官方demo详细剖析
    AIGC-Animate Anyone阿里的图像到视频 角色合成的框架-论文解读
  • 原文地址:https://blog.csdn.net/qq_45764950/article/details/135659489