vue-cli + echarts 组件封装 (Vue2版)

在Vue2中使用ECharts还是比较麻烦的,今天做了几个组件让我们能更加简单的调用Echars来显示图表。

效果展示

在这里插入图片描述
在这里插入图片描述

echarts 导入

这里我们使用 package.json 方式导入Echars。配置好后使用命令 npm install或者其他方式都可以

{
  // ... 
  "scripts": {
  	// ... 
    "setYarn": "yarn config set registry https://registry.npmmirror.com/", // 设置yarn镜像地址
    "yarnInstall": "yarn install", // yarn
  }
 // ... 
 "dependencies": {
 	// ... 
 	"echarts": "^5.4.3", // 博主用的是这个版本可根据自己需求修改
 }
 // ... 
}

父组件引用

<template>
  <div>
    <!-- 操作按钮区域 -->
    <div>
      <a-button @click="loadData" type="primary" icon="sync">刷新</a-button>
    </div>
    <EBarChart title='MSA偏倚直方图' :data="barData" x-label='测量值' y-label='频数' width="90%" height="500px" />
    <ELineChart title='' :data="barData" x-label='测量值' y-label='频数' width="90%" height="500px" />
    <EPieChart title='' :data=" [
            { value: 1048, name: '测量值1' },
            { value: 735, name: '测量值2' },
            { value: 580, name: '测量值3' },
          ]" width="90%" height="500px" />
  </div>
</template>

<script>
import { getAction } from '@/api/manage';
import EBarChart from '@comp/EChart/EBarChart.vue';
import ELineChart from '@comp/EChart/ELineChart.vue'
import EPieChart from '@comp/EChart/EPieChart.vue'

export default {
  name: '',
  components: { ELineChart, EBarChart, EPieChart },
  data() {
    return {
      dataSource: [],
      chartOptions: {},
      barData: {
        x:[],
        y:[],
      },
      url: {
        list: '/msa/msaBias/listAllMsaGroupDataByMainId',
      },
    };
  },
  methods: {
    clearList() {
      this.dataSource = [];
    },
    loadData() {
      this.chartOptions = {};
      this.barData = {
        x: [],
        y: []
      };
      // 这里是请求服务器数据的方式 如果不需要自行修改
      getAction(this.url.list, { pid: this.mainId }).then(res => {
        if (res.success) {
          this.dataSource = res.result.records || res.result;
          const xData = this.dataSource.map(item => String(item.minValue)); // 确保是字符串
          const yData = this.dataSource.map(item => Number(item.sampleCount)); // 确保是数值
          this.barData = {
            x: xData,
            y: yData
          };
        } else {
          this.$message.error(res.message);
        }
      });
    },
  },
};
</script>

<style scoped></style>

柱状图组件

<template>
  <div ref="chartContainer" :style="{ width: width, height: height }"></div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  name: 'EBarChart',
  props: {
    title: { type: String, default: "柱状图" },
    xLabel: { type: String, default: "" },
    yLabel: { type: String, default: "" },
    options: { type: Object, default: () => ({}) },// 自定义options
    data: { type: Object, default: () => ({}) }, // 调用方式{x:[],y:[]}
    width: { type: String, default: '100%' },
    height: { type: String, default: '400px' },
  },
  data() {
    let xLabel = this.xLabel
    let yLabel = this.yLabel
    return {
      chartInstance: null,
      defaultOptions: {
        // 标题配置
        title: {
          text: this.title, // 标题文本
          left: 'center', // 标题位置(居中)
          top: '0px', // 标题距离图表顶部 20px
          textStyle: {
            fontSize: 25, // 标题字体大小
            fontWeight: 'bold', // 标题字体加粗
            color: '#333', // 标题字体颜色
          },
        },
        // 提示框配置
        tooltip: {
          trigger: 'axis', // 触发方式(坐标轴触发)
          backgroundColor: 'rgba(50, 50, 50, 0.7)', // 提示框背景颜色
          borderColor: '#333', // 提示框边框颜色
          borderWidth: 1, // 提示框边框宽度
          padding: 10, // 提示框内边距
          textStyle: {
            fontSize: 18, // 提示框字体大小
            color: '#fff', // 提示框字体颜色
          },
          formatter: function (params) {
            // 自定义提示框内容
            return `${yLabel}: ${params[0].name}<br/>${xLabel}: ${params[0].value}`;
          },
        },
        // 图例配置
        legend: {
          show: true, // 是否显示图例
          data: [yLabel], // 图例数据(与 series.name 对应)
          left: 'right', // 图例位置(右侧)
          textStyle: {
            fontSize: 18, // 图例字体大小
            color: '#333', // 图例字体颜色
          },
        },
        // 网格配置
        grid: {
          left: '10%', // 网格左侧距离
          right: '10%', // 网格右侧距离
          bottom: '15%', // 网格底部距离
          top: '15%',
          containLabel: true, // 是否包含坐标轴标签
        },
        // X 轴配置
        xAxis: {
          type: 'category', // 坐标轴类型(类目轴)
          data: [], // 类目数据
          axisLabel: {
            fontSize: 18, // 标签字体大小
            color: '#333', // 标签字体颜色
            rotate: 0, // 标签旋转角度
            interval: 0, // 强制显示所有标签
          },
          axisLine: {
            lineStyle: {
              color: '#333', // 坐标轴线颜色
              width: 2, // 坐标轴线宽度
            },
          },
          axisTick: {
            show: true, // 是否显示坐标轴刻度
            alignWithLabel: true, // 刻度与标签对齐
          },
          name: xLabel, // 坐标轴名称
          nameLocation: 'center', // 坐标轴名称位置(居中)
          nameGap: 50, // 坐标轴名称与轴线的距离
          nameTextStyle: {
            fontSize: 18, // 坐标轴名称字体大小
            color: '#333', // 坐标轴名称字体颜色
          },
        },
        // Y 轴配置
        yAxis: {
          type: 'value', // 坐标轴类型(数值轴)
          axisLabel: {
            fontSize: 18, // 标签字体大小
            color: '#333', // 标签字体颜色
          },
          axisLine: {
            lineStyle: {
              color: '#333', // 坐标轴线颜色
              width: 2, // 坐标轴线宽度
            },
          },
          axisTick: {
            show: true, // 是否显示坐标轴刻度
          },
          splitLine: {
            show: true, // 是否显示分割线
            lineStyle: {
              color: '#eee', // 分割线颜色
              type: 'dashed', // 分割线类型(虚线)
            },
          },
          name: yLabel, // 坐标轴名称
          nameLocation: 'center', // 坐标轴名称位置(居中)
          nameGap: 50, // 坐标轴名称与轴线的距离
          nameTextStyle: {
            fontSize: 18, // 坐标轴名称字体大小
            color: '#333', // 坐标轴名称字体颜色
          },
        },
        // 数据系列配置
        series: [
          {
            name: yLabel, // 系列名称(与图例对应)
            type: 'bar', // 图表类型(柱状图)
            data: [], // 数据值
            barWidth: 'auto', // 柱状图宽度(自动计算)
            barGap: '5px', // 两个柱子之间的宽度
            label: {
              show: true, // 是否显示标签
              position: 'top', // 标签位置(柱状图顶部)
              fontSize: 18, // 标签字体大小
              color: '#333', // 标签字体颜色
              formatter: '{c}', // 标签内容格式(显示数据值)
            },
            itemStyle: {
              color: '#5470C6', // 柱状图颜色
              borderColor: '#333', // 柱状图边框颜色
              borderWidth: 1, // 柱状图边框宽度
            },
          },
        ],
      },
    };
  },
  mounted() {
    this.initChart();
    window.addEventListener('resize', this.handleResize);
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.handleResize);
    if (this.chartInstance) this.chartInstance.dispose();
  },
  methods: {
    initChart() {
      const dom = this.$refs.chartContainer;
      if (!dom) {
        console.error('Chart container not found!');
        return;
      }
      this.chartInstance = echarts.init(dom);
      const mergedOptions = this.generateOptions();
      console.log('initChart:', mergedOptions); // 打印 mergedOptions
      this.chartInstance.setOption(mergedOptions);
    },
    generateOptions() {
      let mergedOptions = { ...this.defaultOptions };

      if (Object.keys(this.options).length > 0) {
        // 方式一:使用用户自定义的 options
        mergedOptions = this.options;
      } else if (this.data?.x?.length > 0 && this.data?.y?.length > 0) {
        // 方式二:使用默认配置,填充 data
        mergedOptions.xAxis.data = this.data.x;
        mergedOptions.series[0].data = this.data.y;
      }

      console.log('generateOptions:', mergedOptions); // 打印 mergedOptions
      return mergedOptions;
    },
    handleResize() {
      this.chartInstance?.resize();
    },
  },
  watch: {
    options: {
      deep: true,
      handler() {
        if (this.chartInstance) {
          const mergedOptions = this.generateOptions();
          this.chartInstance.setOption(mergedOptions, { notMerge: true }); // 强制更新
        }
      },
    },
    data: {
      deep: true,
      handler() {
        if (this.chartInstance) {
          const mergedOptions = this.generateOptions();
          this.chartInstance.setOption(mergedOptions, { notMerge: true }); // 强制更新
        }
      },
    },
  },
};
</script>

折线图组件

<template>
  <div ref="chartContainer" :style="{ width: width, height: height }"></div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  name: 'ELineChart',
  props: {
    title: { type: String, default: "折线图" },
    xLabel: { type: String, default: "" },
    yLabel: { type: String, default: "" },
    options: { type: Object, default: () => ({}) }, // 自定义options
    data: { type: Object, default: () => ({}) }, // 调用方式{x:[],y:[]}
    width: { type: String, default: '100%' },
    height: { type: String, default: '400px' },
  },
  data() {
    let xLabel = this.xLabel
    let yLabel = this.yLabel
    return {
      chartInstance: null,
      defaultOptions: {
        // 标题配置
        title: {
          text: this.title, // 标题文本
          left: 'center', // 标题位置(居中)
          top: '0px', // 标题距离图表顶部 20px
          textStyle: {
            fontSize: 25, // 标题字体大小
            fontWeight: 'bold', // 标题字体加粗
            color: '#333', // 标题字体颜色
          },
        },
        // 提示框配置
        tooltip: {
          trigger: 'axis', // 触发方式(坐标轴触发)
          backgroundColor: 'rgba(50, 50, 50, 0.7)', // 提示框背景颜色
          borderColor: '#333', // 提示框边框颜色
          borderWidth: 1, // 提示框边框宽度
          padding: 10, // 提示框内边距
          textStyle: {
            fontSize: 18, // 提示框字体大小
            color: '#fff', // 提示框字体颜色
          },
          formatter: function (params) {
            // 自定义提示框内容
            return `${yLabel}: ${params[0].name}<br/>${xLabel}: ${params[0].value}`;
          },
        },
        // 图例配置
        legend: {
          show: true, // 是否显示图例
          data: [yLabel], // 图例数据(与 series.name 对应)
          left: 'right', // 图例位置(右侧)
          textStyle: {
            fontSize: 18, // 图例字体大小
            color: '#333', // 图例字体颜色
          },
        },
        // 网格配置
        grid: {
          left: '10%', // 网格左侧距离
          right: '10%', // 网格右侧距离
          bottom: '15%', // 网格底部距离
          top: '15%',
          containLabel: true, // 是否包含坐标轴标签
        },
        // X 轴配置
        xAxis: {
          type: 'category', // 坐标轴类型(类目轴)
          data: [], // 类目数据
          axisLabel: {
            fontSize: 18, // 标签字体大小
            color: '#333', // 标签字体颜色
            rotate: 0, // 标签旋转角度
            interval: 0, // 强制显示所有标签
          },
          axisLine: {
            lineStyle: {
              color: '#333', // 坐标轴线颜色
              width: 2, // 坐标轴线宽度
            },
          },
          axisTick: {
            show: true, // 是否显示坐标轴刻度
            alignWithLabel: true, // 刻度与标签对齐
          },
          name: xLabel, // 坐标轴名称
          nameLocation: 'center', // 坐标轴名称位置(居中)
          nameGap: 50, // 坐标轴名称与轴线的距离
          nameTextStyle: {
            fontSize: 18, // 坐标轴名称字体大小
            color: '#333', // 坐标轴名称字体颜色
          },
        },
        // Y 轴配置
        yAxis: {
          type: 'value', // 坐标轴类型(数值轴)
          axisLabel: {
            fontSize: 18, // 标签字体大小
            color: '#333', // 标签字体颜色
          },
          axisLine: {
            lineStyle: {
              color: '#333', // 坐标轴线颜色
              width: 2, // 坐标轴线宽度
            },
          },
          axisTick: {
            show: true, // 是否显示坐标轴刻度
          },
          splitLine: {
            show: true, // 是否显示分割线
            lineStyle: {
              color: '#eee', // 分割线颜色
              type: 'dashed', // 分割线类型(虚线)
            },
          },
          name: yLabel, // 坐标轴名称
          nameLocation: 'center', // 坐标轴名称位置(居中)
          nameGap: 50, // 坐标轴名称与轴线的距离
          nameTextStyle: {
            fontSize: 18, // 坐标轴名称字体大小
            color: '#333', // 坐标轴名称字体颜色
          },
        },
        // 数据系列配置
        series: [
          {
            name: yLabel, // 系列名称(与图例对应)
            type: 'line', // 图表类型(折线图)
            data: [], // 数据值
            label: {
              show: true, // 是否显示标签
              position: 'top', // 标签位置(折线图顶部)
              fontSize: 18, // 标签字体大小
              color: '#333', // 标签字体颜色
              formatter: '{c}', // 标签内容格式(显示数据值)
            },
            itemStyle: {
              color: '#5470C6', // 折线图颜色
              borderColor: '#333', // 折线图边框颜色
              borderWidth: 1, // 折线图边框宽度
            },
            lineStyle: {
              color: '#5470C6', // 折线颜色
              width: 2, // 折线宽度
            },
            symbol: 'circle', // 数据点形状
            symbolSize: 8, // 数据点大小
          },
        ],
      },
    };
  },
  mounted() {
    this.initChart();
    window.addEventListener('resize', this.handleResize);
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.handleResize);
    if (this.chartInstance) this.chartInstance.dispose();
  },
  methods: {
    initChart() {
      const dom = this.$refs.chartContainer;
      if (!dom) {
        console.error('Chart container not found!');
        return;
      }
      this.chartInstance = echarts.init(dom);
      const mergedOptions = this.generateOptions();
      console.log('initChart:', mergedOptions); // 打印 mergedOptions
      this.chartInstance.setOption(mergedOptions);
    },
    generateOptions() {
      let mergedOptions = { ...this.defaultOptions };

      if (Object.keys(this.options).length > 0) {
        // 方式一:使用用户自定义的 options
        mergedOptions = this.options;
      } else if (this.data?.x?.length > 0 && this.data?.y?.length > 0) {
        // 方式二:使用默认配置,填充 data
        mergedOptions.xAxis.data = this.data.x;
        mergedOptions.series[0].data = this.data.y;
      }

      console.log('generateOptions:', mergedOptions); // 打印 mergedOptions
      return mergedOptions;
    },
    handleResize() {
      this.chartInstance?.resize();
    },
  },
  watch: {
    options: {
      deep: true,
      handler() {
        if (this.chartInstance) {
          const mergedOptions = this.generateOptions();
          this.chartInstance.setOption(mergedOptions, { notMerge: true }); // 强制更新
        }
      },
    },
    data: {
      deep: true,
      handler() {
        if (this.chartInstance) {
          const mergedOptions = this.generateOptions();
          this.chartInstance.setOption(mergedOptions, { notMerge: true }); // 强制更新
        }
      },
    },
  },
};
</script>

饼图组件

<template>
  <div ref="chartContainer" :style="{ width: width, height: height }"></div>
</template>

<script>
import * as echarts from 'echarts';

export default {
  name: 'EPieChart',
  props: {
    title: { type: String, default: "饼图" },
    options: { type: Object, default: () => ({}) },
    data: { type: Object, default: () => ([]) },// 调用方式 [{ value: 1048, name: '测量值1' },...]
    width: { type: String, default: '100%' },
    height: { type: String, default: '400px' },
  },
  data() {
    return {
      chartInstance: null,
      defaultOptions: {
        // 标题配置
        title: {
          text: this.title, // 标题文本
          left: 'center', // 标题位置(居中)
          top: '0px', // 标题距离图表顶部 20px
          textStyle: {
            fontSize: 25, // 标题字体大小
            fontWeight: 'bold', // 标题字体加粗
            color: '#333', // 标题字体颜色
          },
        },
        // 提示框配置
        tooltip: {
          trigger: 'item', // 触发方式(数据项触发)
          backgroundColor: 'rgba(50, 50, 50, 0.7)', // 提示框背景颜色
          borderColor: '#333', // 提示框边框颜色
          borderWidth: 1, // 提示框边框宽度
          padding: 10, // 提示框内边距
          textStyle: {
            fontSize: 18, // 提示框字体大小
            color: '#fff', // 提示框字体颜色
          },
          formatter: function (params) {
            // 自定义提示框内容
            return `${params.name}: ${params.value} (${params.percent}%)`;
          },
        },
        // 图例配置
        legend: {
          show: true, // 是否显示图例
          left: 'right', // 图例位置(右侧)
          textStyle: {
            fontSize: 18, // 图例字体大小
            color: '#333', // 图例字体颜色
          },
        },
        // 数据系列配置
        series: [
          {
            name: '频数', // 系列名称(与图例对应)
            type: 'pie', // 图表类型(饼图)
            radius: '50%', // 饼图半径(50%表示占容器的一半)
            data: [], // 数据值
            label: {
              show: true, // 是否显示标签
              fontSize: 18, // 标签字体大小
              color: '#333', // 标签字体颜色
              formatter: '{b}: {c} ({d}%)', // 标签内容格式(显示名称、值和百分比)
            },
            itemStyle: {
              borderColor: '#fff', // 饼图边框颜色
              borderWidth: 2, // 饼图边框宽度
            },
            emphasis: {
              // 高亮样式
              label: {
                show: true,
                fontSize: 20,
                fontWeight: 'bold',
              },
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: 'rgba(0, 0, 0, 0.5)',
              },
            },
          },
        ],
      },
    };
  },
  mounted() {
    this.initChart();
    window.addEventListener('resize', this.handleResize);
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.handleResize);
    if (this.chartInstance) this.chartInstance.dispose();
  },
  methods: {
    initChart() {
      const dom = this.$refs.chartContainer;
      if (!dom) {
        console.error('Chart container not found!');
        return;
      }
      this.chartInstance = echarts.init(dom);
      const mergedOptions = this.generateOptions();
      console.log('initChart:', mergedOptions); // 打印 mergedOptions
      this.chartInstance.setOption(mergedOptions);
    },
    generateOptions() {
      let mergedOptions = { ...this.defaultOptions };

      if (Object.keys(this.options).length > 0) {
        // 方式一:使用用户自定义的 options
        mergedOptions = this.options;
      } else if (this.data?.length > 0) {
        // 方式二:使用默认配置,填充 data
        mergedOptions.series[0].data = this.data;
      }

      console.log('generateOptions:', mergedOptions); // 打印 mergedOptions
      return mergedOptions;
    },
    handleResize() {
      this.chartInstance?.resize();
    },
  },
  watch: {
    options: {
      deep: true,
      handler() {
        if (this.chartInstance) {
          const mergedOptions = this.generateOptions();
          this.chartInstance.setOption(mergedOptions, { notMerge: true }); // 强制更新
        }
      },
    },
    data: {
      deep: true,
      handler() {
        if (this.chartInstance) {
          const mergedOptions = this.generateOptions();
          this.chartInstance.setOption(mergedOptions, { notMerge: true }); // 强制更新
        }
      },
    },
  },
};
</script>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/984919.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

基于编译器特性浅析C++程序性能优化

最近在恶补计算机基础知识&#xff0c;学到CSAPP第五章的内容&#xff0c;在这里总结并且展开一下C程序性能优化相关的内容。 衡量程序性能的方式 一般而言&#xff0c;程序的性能可以用CPE&#xff08;Cycles Per Element&#xff09;来衡量&#xff0c;其指的是处理每个元素…

多模态融合的分类、跨模态对齐的方法

两者的主要区别 维度扩模态对齐扩模态融合目标对齐模态间的表示&#xff0c;使其语义一致融合模态间的信息&#xff0c;生成联合表示关注点模态间的相似性和语义一致性模态间的互补性和信息整合空间映射到共享的公共语义空间生成新的联合特征空间方法对比学习、共享空间、注意…

计算机网络--访问一个网页的全过程

文章目录 访问一个网页的全过程应用层在浏览器输入URL网址http://www.aspxfans.com:8080/news/index.aspboardID5&ID24618&page1#r_70732423通过DNS获取IP地址生成HTTP请求报文应用层最后 传输层传输层处理应用层报文建立TCP连接传输层最后 网络层网络层对TCP报文进行处…

自动化测试脚本语言选择

测试人员在选择自动化测试脚本语言时面临多种选项。Python、Java、C#、JavaScript 和 Ruby 都是常见选择&#xff0c;但哪种语言最适合&#xff1f;本文将详细分析这些语言的特点、适用场景和优劣势&#xff0c;结合行业趋势和社会现象&#xff0c;为测试人员提供全面指导。 选…

Oracle 字符类型对比

本文以 Oracle12c 为例 1.主要区别对比 类型存储方式最大长度字符集支持适用场景备注​CHAR(M)固定长度空格填充2000 字节&#xff0c;M 代表字节长度默认字符集固定长度编码实际存储长度固定为定义长度&#xff08;如 CHAR(10) 始终占 10 字节&#xff09;​VARCHAR2(M)可变长…

Nginx(基础安装+配置文件)

目录 一.Nginx基础 1.基础知识点 2.异步非阻塞机制 二.Nginx安装 2.1安装nginx3种方式 1.包管理工具安装&#xff08;yum/apt&#xff09; 2.本地包安装&#xff08;rpm/dpkg&#xff09; 3.源码编译安装 3.1 源码编译安装nginx流程&#xff08;ubuntu&#xff09; 1.…

PyCharm 接入 DeepSeek、OpenAI、Gemini、Mistral等大模型完整版教程(通用)!

PyCharm 接入 DeepSeek、OpenAI、Gemini、Mistral等大模型完整版教程&#xff08;通用&#xff09;&#xff01; 当我们成功接入大模型时&#xff0c;可以选中任意代码区域进行解答&#xff0c;共分为三个区域&#xff0c;分别是选中区域、提问区域以及回答区域&#xff0c;我…

Python——计算机网络

一.ip 1.ip的定义 IP是“Internet Protocol”的缩写&#xff0c;即“互联网协议”。它是用于计算机网络通信的基础协议之一&#xff0c;属于TCP/IP协议族中的网络层协议。IP协议的主要功能是负责将数据包从源主机传输到目标主机&#xff0c;并确保数据能够在复杂的网络环境中正…

【LeetCode合并区间C++实现】【c++】【合并区间】

LeetCode合并区间C实现 LeetCode 56题思路图示完整代码运行结果代码或思路哪里有误还请指正&#xff01;&#xff01;thank you!! LeetCode 56题 以数组 intervals 表示若干个区间的集合&#xff0c;其中单个区间为 intervals[i] [starti, endi] 。请你合并所有重叠的区间&am…

笔记六:单链表链表介绍与模拟实现

在他一生中&#xff0c;从来没有人能够像你们这样&#xff0c;以他的视角看待这个世界。 ---------《寻找天堂》 目录 文章目录 一、什么是链表&#xff1f; 二、为什么要使用链表&#xff1f; 三、 单链表介绍与使用 3.1 单链表 3.1.1 创建单链表节点 3.1.2 单链表的头插、…

使用Modelsim手动仿真

FPGA设计流程 在设计输入之后,设计综合前进行 RTL 级仿真,称为综合前仿真,也称为前仿真或 功能仿真。前仿真也就是纯粹的功能仿真,主旨在于验证电路的功能是否符合设计要求,其特点是不考虑电路门延迟与线延迟。在完成一个设计的代码编写工作之后,可以直接对代码进行仿真,…

Docker搭建Redis哨兵模式【一主两从三哨兵】

Docker搭建Redis哨兵模式 系统: CentOS 7 Dockder 版本: VMware虚拟机 网络适配器 网络连接 桥接模式:直接连接物理网络查看IP命令 ip addr一、哨兵模式概述 1. 官方文档与关联博客 官方文档:https://redis.io/docs/latest/operate/oss_and_stack/management/sentinel关联博…

(更新完)LPZero: Language Model Zero-cost Proxy Search from Zero

LPZero代码 摘要 神经架构搜索 (NAS) 有助于自动执行有效的神经网络搜索&#xff0c;同时需要大量的计算资源&#xff0c;尤其是对于语言模型。零样本 NAS 利用零成本 (ZC) 代理来估计模型性能&#xff0c;从而显着降低计算需求。然而&#xff0c;现有的 ZC 代理严重依赖于深…

【互联网性能指标】QPS/TPS/PV/UV/IP/GMV/DAU/MAU/RPS

&#x1f4d5;我是廖志伟&#xff0c;一名Java开发工程师、《Java项目实战——深入理解大型互联网企业通用技术》&#xff08;基础篇&#xff09;、&#xff08;进阶篇&#xff09;、&#xff08;架构篇&#xff09;清华大学出版社签约作家、Java领域优质创作者、CSDN博客专家、…

【Linux docker】关于docker启动出错的解决方法。

无论遇到什么docker启动不了的问题 就是 查看docker状态sytemctl status docker查看docker日志sudo journalctl -u docker.service查看docker三个配置文件&#xff08;可能是配置的时候格式错误&#xff09;&#xff1a;/etc/docker/daemon.json&#xff08;如果存在&#xf…

拉取gitlab项目时出现500的错误的权限问题

title: 拉取gitlab项目时出现500的错误的权限问题 date: 2025-03-10 18:09:08 tags: gitlabgit拉取gitlab项目时出现500的错误的权限问题 Gitlab克隆代码**我遇到的问题错误**:**问题解决步骤**:1、确定你可以浏览器访问到项目页面2、确定你的邮箱或账号已添加,有权限可以拉…

MobileBERT: 一种适用于资源有限设备的紧凑型任务无关BERT

摘要 近年来&#xff0c;自然语言处理&#xff08;NLP&#xff09;通过使用具有数亿参数的巨大预训练模型取得了巨大成功。然而&#xff0c;这些模型存在模型体积庞大和延迟高的问题&#xff0c;使得它们无法部署到资源有限的移动设备上。在本文中&#xff0c;我们提出了Mobil…

【C】初阶数据结构9 -- 直接插入排序

前面我们学习了数据结构二叉树&#xff0c;接下来我们将开启一个新的章节&#xff0c;那就是在日常生活中经常会用到的排序算法。 所谓排序算法就是给你一堆数据&#xff0c;让你从小到大&#xff08;或从大到小&#xff09;的将这些数据排成一个有序的序列&#xff08;这些数据…

OpenPose初体验

最近机器人的热度有点高&#xff0c;想着要做些应用技术储备&#xff0c;偶然的机会发现了OpenPose&#xff0c;就从它开始吧&#xff01;OpenPose是由卡内基梅隆大学开发的开源实时多人姿态估计库。它基于深度学习算法&#xff0c;能精确识别图像或视频中的人体姿态&#xff0…

从0开始的操作系统手搓教程33:挂载我们的文件系统

目录 代码实现 添加到初始化上 上电看现象 挂载分区可能是一些朋友不理解的——实际上挂载就是将我们的文件系统封装好了的设备&#xff08;硬盘啊&#xff0c;SD卡啊&#xff0c;U盘啊等等&#xff09;&#xff0c;挂到我们的默认分区路径下。这样我们就能访问到了&#xff…