vue三种方式导出报表至excel

1、序言

        1.1、源码

        源码在下方,复制运行,安装相应的插件即可

        1.2、坑

        方式一、方式二安装相同插件:

npm install xlsx xlsx-style file-saver

        导入 xlsx-style 会报如下的错误

         解决办法:

        (1)去node_modules下面找到xlsx/dist/  修改相应配置,这样非常不好,每次npm install,都要跑去node_modules下面修改,非常麻烦!

        (2)新建vue.config.js,复制如下代码,重启项目即可

module.exports = {configureWebpack: (config) => {// 解决xlsx-style报错的问题return {externals: [{'./cptable': 'var cptable'}]}}
}

         还有一个坑

        

         解决办法:

 

        1.3、实现功能说明

未实现:

(1)单元格样式修改还未实现,后期找到合适的方法会更新此博客

(2)不能导出图片至excel表中,只把表格数据导出至excel表

(3)导出的excel报表没有多个Sheet

 

已实现:

(1)表格正常导出

(2)多级表头导出

(3)单元格自定义内容、合计行导出 

2、方式一(xlsx)(不推荐)

        2.1、工具方法

                Export2Excel.js

export function export_json_to_excel({multiHeader = [], // 第一行表头multiHeader2 = [],	// 第二行表头data,filename, //文件名merges = [], // 合并bookType = 'xlsx'
} = {}) {/* original data */filename = filename || '列表';data = [...data]data.unshift(multiHeader2)data.unshift(multiHeader)console.log('data:', data)var ws_name = "SheetJS";var wb = new Workbook(),ws = sheet_from_array_of_arrays(data);if (merges.length > 0) {if (!ws['!merges']) ws['!merges'] = [];merges.forEach(item => {ws['!merges'].push(XLSX.utils.decode_range(item))})}/* add worksheet to workbook */wb.SheetNames.push(ws_name);wb.Sheets[ws_name] = ws;var wbout = XLSXStyle.write(wb, {bookType: bookType,bookSST: false,type: 'binary'});saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), `${filename}.${bookType}`);
}

        2.2、使用

// multiHeader: 一级表头
// multiHeader2:二级表头
// data:表格数据
// merges:需要合并的单元格
// filename:导出的excel文件名
import('@/utils/Export2Excel').then((excel) => {excel.export_json_to_excel({multiHeader,multiHeader2,data,merges,filename: '报表导出一',});})

        2.3、目标效果

 

        2.4、缺点

(1)没有合计行

(2)表格插槽自定义的内容,如添加的单位: kg、cm、岁不能一起导出来

(3)最痛苦的是多级表头导出的时候还要一个个算单元格哪些需要合并、多级表头数组的字段排放,字段少还好,多的时候就痛苦面具了!

 

3、方式二(xlsx结合dom)(推荐)

        3.1、工具方法

                Export2Excel.js

// 根据dom导出表格
export function exportToExcel(idSelector, fileName, titleNum = 1) {// 设置导出的内容是否只做解析,不进行格式转换     false:要解析, true:不解析const xlsxParam = { raw: true }let table = document.querySelector(idSelector).cloneNode(true);// 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉if (table.querySelector('.el-table__fixed-right'))table.removeChild(table.querySelector('.el-table__fixed-right'));if (table.querySelector('.el-table__fixed'))table.removeChild(table.querySelector('.el-table__fixed'));const wb = XLSX.utils.table_to_book(table, xlsxParam)let range = XLSX.utils.decode_range(wb.Sheets['Sheet1']['!ref']);let cWidth = [];for (let C = range.s.c; C < range.e.c; ++C) {   //SHEET列let len = 100; //默认列宽let len_max = 400; //最大列宽for (let R = range.s.r; R <= range.e.r; ++R) {  //SHEET行let cell = { c: C, r: R };                    //二维 列行确定一个单元格let cell_ref = XLSX.utils.encode_cell(cell);  //单元格 A1、A2if (wb.Sheets['Sheet1'][cell_ref]) {// if (R == 0){if (R < titleNum) {wb.Sheets['Sheet1'][cell_ref].s = {  //设置第一行单元格的样式 stylealignment: {horizontal: 'center',vertical: 'center',},};} else {wb.Sheets['Sheet1'][cell_ref].s = {alignment: {horizontal: 'center',vertical: 'center',},};}//动态自适应:计算列宽let va = JSON.parse(JSON.stringify(wb.Sheets['Sheet1'][cell_ref].v));var card1 = JSON.parse(JSON.stringify(va)).match(/[\u4e00-\u9fa5]/g); //匹配中文var card11 = "";if (card1) {card11 = card1.join("")}var card2 = JSON.parse(JSON.stringify(va)).replace(/([^\u0000-\u00FF])/g, "");  //剔除中文let st = 0;if (card11) {// st += card11.length * 16  //中文字节码长度st += card11.length * 20  //中文字节码长度}if (card2) {// st += card2.length * 8  //非中文字节码长度st += card2.length * 10  //非中文字节码长度}if (st > len) {len = st;}}}if (len > len_max) {//最大宽度len = len_max;}cWidth.push({ 'wpx': len });     //列宽}wb.Sheets['Sheet1']['!cols'] = cWidthconst wbout = XLSXStyle.write(wb, { bookType: 'xlsx', bookSST: false, type: 'binary' })try {saveAs(new Blob([s2ab(wbout)], { type: '' }), `${fileName}.xlsx`)} catch (e) {if (typeof console !== 'undefined') {console.log(e, wbout)}}return wbout
}

        3.2、使用

import { exportToExcel } from '@/utils/Export2Excel'
methods: {// 方式二导出报表handleExport2() {// exportToExcel(表格id选择器, 导出文件名称);exportToExcel('#table', '报表导出二');},}

        3.2、效果

 

        除了合计行有点小小的瑕疵,其他部分非常完美了,代码少,实现的功能又多,相当于导出el-table了! 

4、方式三(vue-json-excel)(不推荐)

# 安装插件

npm i vue-json-excel

 

# 插件官网:GitHub - jecovier/vue-json-excel

        4.1、使用

        字段说明       

字段名称字段类型字段说明
dataArray表格数据
fieldsObject不填写的话,导出的excel表头名称为 data数据里面的属性名称,其实就是字段名称映射成中文
typestring导出的文件类型,默认xls
namestring导出的文件名称
titlestringexcel表格标题

        main.js

import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';import JsonExcel from "vue-json-excel";
Vue.component("downloadExcel", JsonExcel);
Vue.use(ElementUI);new Vue({render: h => h(App),
}).$mount('#app')

         页面使用

        每个字段可以自定义单元格格式化输出内容,比如加上单位 

        4.2、效果         

 

        4.3、缺点

(1)多级表头导不出来,官方文档写的不够详细

(2)没有合计行         

(3)配置稍显繁琐

5、源码

vue.config.js

module.exports = {configureWebpack: (config) => {// 解决xlsx-style报错的问题return {externals: [{'./cptable': 'var cptable'}]}}
}

main.js

import Vue from 'vue'
import App from './App.vue'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import JsonExcel from "vue-json-excel";
Vue.component("downloadExcel", JsonExcel);
Vue.use(ElementUI);
Vue.config.productionTip = falsenew Vue({render: h => h(App),
}).$mount('#app')

App.vue

<template><div id="app"><div style="display: flex; justify-content: center;"><el-button type="success" @click="handleExport">导出一</el-button><el-button type="primary" @click="handleExport2">导出二</el-button><download-excel :data="tableData" :fields="fields" name="报表三"><el-button type="warning">导出三</el-button></download-excel></div><el-table :data="tableData" id="table" ref="table" border style="width: 100%; margin-top: 20px;" show-summary><el-table-column prop="date" label="日期" width="180"></el-table-column><el-table-column prop="name" label="姓名" width="180"></el-table-column><el-table-column label="个人信息" align="center"><el-table-column prop="height" label="身高"><template slot-scope="{row}">{{ row.height + 'cm' }}</template></el-table-column><el-table-column prop="weight" label="体重"><template slot-scope="{row}">{{ row.weight + 'kg' }}</template></el-table-column><el-table-column prop="age" label="年龄"><template slot-scope="{row}">{{ row.age + '岁' }}</template></el-table-column></el-table-column></el-table></div>
</template><script>
import { exportToExcel } from '@/utils/Export2Excel'
export default {name: 'App',components: {},data() {return {tableData: [{date: '2016-05-03',name: '王大虎',age: 20,weight: 70,height: 188}, {date: '2016-05-02',name: '王二虎',age: 18,weight: 60,height: 177}, {date: '2016-05-04',name: '王小虎',age: 16,weight: 50,height: 166}],fields: {'日期': 'date','姓名': 'name','身高': {field: 'height',callback: (value) => {return `${value} cm`;},},'体重': {field: 'weight',callback: (value) => {return `${value} kg`;},},'年龄': {field: 'age',callback: (value) => {return `${value} 岁`;},},}}},methods: {// 方式一导出报表handleExport() {// 一级表头const multiHeader = ["日期","姓名","个人信息",];// 二级表头const multiHeader2 = ["","","身高","体重","年龄",];// 根据Excel确定要合并的单元格const merges = ["A1:A2","B1:B2","C1:E1",];// const header = this.$refs.table.columns.map(item => item.label)const columns = this.$refs.table.columns.map(item => item.property)const data = this.tableData.map(v => columns.map(j => v[j]));import('@/utils/Export2Excel').then((excel) => {excel.export_json_to_excel({multiHeader,multiHeader2,data,merges,filename: '报表导出一',});})},// 方式二导出报表handleExport2() {exportToExcel('#table', '报表导出二');},}
}
</script><style>
#app {font-family: Avenir, Helvetica, Arial, sans-serif;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;text-align: center;color: #2c3e50;
}
</style>

utils/Export2Excel.js

/* eslint-disable */
import { saveAs } from 'file-saver'
import * as XLSX from 'xlsx'
import * as XLSXStyle from "xlsx-style";function datenum(v, date1904) {if (date1904) v += 1462;var epoch = Date.parse(v);return (epoch - new Date(Date.UTC(1899, 11, 30))) / (24 * 60 * 60 * 1000);
}function sheet_from_array_of_arrays(data, opts) {var ws = {};var range = {s: {c: 10000000,r: 10000000},e: {c: 0,r: 0}};for (var R = 0; R != data.length; ++R) {for (var C = 0; C != data[R].length; ++C) {if (range.s.r > R) range.s.r = R;if (range.s.c > C) range.s.c = C;if (range.e.r < R) range.e.r = R;if (range.e.c < C) range.e.c = C;var cell = {v: data[R][C]};if (cell.v == null) continue;var cell_ref = XLSX.utils.encode_cell({c: C,r: R});if (typeof cell.v === 'number') cell.t = 'n';else if (typeof cell.v === 'boolean') cell.t = 'b';else if (cell.v instanceof Date) {cell.t = 'n';cell.z = XLSX.SSF._table[14];cell.v = datenum(cell.v);}else cell.t = 's';ws[cell_ref] = cell;}}if (range.s.c < 10000000) ws['!ref'] = XLSX.utils.encode_range(range);return ws;
}function Workbook() {if (!(this instanceof Workbook)) return new Workbook();this.SheetNames = [];this.Sheets = {};
}function s2ab(s) {var buf = new ArrayBuffer(s.length);var view = new Uint8Array(buf);for (var i = 0; i != s.length; ++i) view[i] = s.charCodeAt(i) & 0xFF;return buf;
}export function export_json_to_excel({multiHeader = [], // 第一行表头multiHeader2 = [],	// 第二行表头data,filename, //文件名merges = [], // 合并bookType = 'xlsx'
} = {}) {/* original data */filename = filename || '列表';data = [...data]data.unshift(multiHeader2)data.unshift(multiHeader)console.log('data:', data)var ws_name = "SheetJS";var wb = new Workbook(),ws = sheet_from_array_of_arrays(data);if (merges.length > 0) {if (!ws['!merges']) ws['!merges'] = [];merges.forEach(item => {ws['!merges'].push(XLSX.utils.decode_range(item))})}/* add worksheet to workbook */wb.SheetNames.push(ws_name);wb.Sheets[ws_name] = ws;var wbout = XLSXStyle.write(wb, {bookType: bookType,bookSST: false,type: 'binary'});saveAs(new Blob([s2ab(wbout)], {type: "application/octet-stream"}), `${filename}.${bookType}`);
}// 根据dom导出表格
export function exportToExcel(idSelector, fileName, titleNum = 1) {// 设置导出的内容是否只做解析,不进行格式转换     false:要解析, true:不解析const xlsxParam = { raw: true }let table = document.querySelector(idSelector).cloneNode(true);// 因为element-ui的表格的fixed属性导致多出一个table,会下载重复内容,这里删除掉if (table.querySelector('.el-table__fixed-right'))table.removeChild(table.querySelector('.el-table__fixed-right'));if (table.querySelector('.el-table__fixed'))table.removeChild(table.querySelector('.el-table__fixed'));const wb = XLSX.utils.table_to_book(table, xlsxParam)let range = XLSX.utils.decode_range(wb.Sheets['Sheet1']['!ref']);let cWidth = [];for (let C = range.s.c; C < range.e.c; ++C) {   //SHEET列let len = 100; //默认列宽let len_max = 400; //最大列宽for (let R = range.s.r; R <= range.e.r; ++R) {  //SHEET行let cell = { c: C, r: R };                    //二维 列行确定一个单元格let cell_ref = XLSX.utils.encode_cell(cell);  //单元格 A1、A2if (wb.Sheets['Sheet1'][cell_ref]) {// if (R == 0){if (R < titleNum) {wb.Sheets['Sheet1'][cell_ref].s = {  //设置第一行单元格的样式 stylealignment: {horizontal: 'center',vertical: 'center',},};} else {wb.Sheets['Sheet1'][cell_ref].s = {alignment: {horizontal: 'center',vertical: 'center',},};}//动态自适应:计算列宽let va = JSON.parse(JSON.stringify(wb.Sheets['Sheet1'][cell_ref].v));var card1 = JSON.parse(JSON.stringify(va)).match(/[\u4e00-\u9fa5]/g); //匹配中文var card11 = "";if (card1) {card11 = card1.join("")}var card2 = JSON.parse(JSON.stringify(va)).replace(/([^\u0000-\u00FF])/g, "");  //剔除中文let st = 0;if (card11) {// st += card11.length * 16  //中文字节码长度st += card11.length * 20  //中文字节码长度}if (card2) {// st += card2.length * 8  //非中文字节码长度st += card2.length * 10  //非中文字节码长度}if (st > len) {len = st;}}}if (len > len_max) {//最大宽度len = len_max;}cWidth.push({ 'wpx': len });     //列宽}wb.Sheets['Sheet1']['!cols'] = cWidthconst wbout = XLSXStyle.write(wb, { bookType: 'xlsx', bookSST: false, type: 'binary' })try {saveAs(new Blob([s2ab(wbout)], { type: '' }), `${fileName}.xlsx`)} catch (e) {if (typeof console !== 'undefined') {console.log(e, wbout)}}return wbout
}

utils/Blob.js

/* eslint-disable */
/* Blob.js* A Blob implementation.* 2014-05-27** By Eli Grey, http://eligrey.com* By Devin Samarin, https://github.com/eboyjr* License: X11/MIT*   See LICENSE.md*//*global self, unescape */
/*jslint bitwise: true, regexp: true, confusion: true, es5: true, vars: true, white: true,plusplus: true *//*! @source http://purl.eligrey.com/github/Blob.js/blob/master/Blob.js */(function (view) {"use strict";view.URL = view.URL || view.webkitURL;if (view.Blob && view.URL) {try {new Blob;return;} catch (e) {}}// Internally we use a BlobBuilder implementation to base Blob off of// in order to support older browsers that only have BlobBuildervar BlobBuilder = view.BlobBuilder || view.WebKitBlobBuilder || view.MozBlobBuilder || (function(view) {varget_class = function(object) {return Object.prototype.toString.call(object).match(/^\[object\s(.*)\]$/)[1];}, FakeBlobBuilder = function BlobBuilder() {this.data = [];}, FakeBlob = function Blob(data, type, encoding) {this.data = data;this.size = data.length;this.type = type;this.encoding = encoding;}, FBB_proto = FakeBlobBuilder.prototype, FB_proto = FakeBlob.prototype, FileReaderSync = view.FileReaderSync, FileException = function(type) {this.code = this[this.name = type];}, file_ex_codes = ("NOT_FOUND_ERR SECURITY_ERR ABORT_ERR NOT_READABLE_ERR ENCODING_ERR "+ "NO_MODIFICATION_ALLOWED_ERR INVALID_STATE_ERR SYNTAX_ERR").split(" "), file_ex_code = file_ex_codes.length, real_URL = view.URL || view.webkitURL || view, real_create_object_URL = real_URL.createObjectURL, real_revoke_object_URL = real_URL.revokeObjectURL, URL = real_URL, btoa = view.btoa, atob = view.atob, ArrayBuffer = view.ArrayBuffer, Uint8Array = view.Uint8Array;FakeBlob.fake = FB_proto.fake = true;while (file_ex_code--) {FileException.prototype[file_ex_codes[file_ex_code]] = file_ex_code + 1;}if (!real_URL.createObjectURL) {URL = view.URL = {};}URL.createObjectURL = function(blob) {vartype = blob.type, data_URI_header;if (type === null) {type = "application/octet-stream";}if (blob instanceof FakeBlob) {data_URI_header = "data:" + type;if (blob.encoding === "base64") {return data_URI_header + ";base64," + blob.data;} else if (blob.encoding === "URI") {return data_URI_header + "," + decodeURIComponent(blob.data);} if (btoa) {return data_URI_header + ";base64," + btoa(blob.data);} else {return data_URI_header + "," + encodeURIComponent(blob.data);}} else if (real_create_object_URL) {return real_create_object_URL.call(real_URL, blob);}};URL.revokeObjectURL = function(object_URL) {if (object_URL.substring(0, 5) !== "data:" && real_revoke_object_URL) {real_revoke_object_URL.call(real_URL, object_URL);}};FBB_proto.append = function(data/*, endings*/) {var bb = this.data;// decode data to a binary stringif (Uint8Array && (data instanceof ArrayBuffer || data instanceof Uint8Array)) {varstr = "", buf = new Uint8Array(data), i = 0, buf_len = buf.length;for (; i < buf_len; i++) {str += String.fromCharCode(buf[i]);}bb.push(str);} else if (get_class(data) === "Blob" || get_class(data) === "File") {if (FileReaderSync) {var fr = new FileReaderSync;bb.push(fr.readAsBinaryString(data));} else {// async FileReader won't work as BlobBuilder is syncthrow new FileException("NOT_READABLE_ERR");}} else if (data instanceof FakeBlob) {if (data.encoding === "base64" && atob) {bb.push(atob(data.data));} else if (data.encoding === "URI") {bb.push(decodeURIComponent(data.data));} else if (data.encoding === "raw") {bb.push(data.data);}} else {if (typeof data !== "string") {data += ""; // convert unsupported types to strings}// decode UTF-16 to binary stringbb.push(unescape(encodeURIComponent(data)));}};FBB_proto.getBlob = function(type) {if (!arguments.length) {type = null;}return new FakeBlob(this.data.join(""), type, "raw");};FBB_proto.toString = function() {return "[object BlobBuilder]";};FB_proto.slice = function(start, end, type) {var args = arguments.length;if (args < 3) {type = null;}return new FakeBlob(this.data.slice(start, args > 1 ? end : this.data.length), type, this.encoding);};FB_proto.toString = function() {return "[object Blob]";};FB_proto.close = function() {this.size = this.data.length = 0;};return FakeBlobBuilder;}(view));view.Blob = function Blob(blobParts, options) {var type = options ? (options.type || "") : "";var builder = new BlobBuilder();if (blobParts) {for (var i = 0, len = blobParts.length; i < len; i++) {builder.append(blobParts[i]);}}return builder.getBlob(type);};
}(typeof self !== "undefined" && self || typeof window !== "undefined" && window || this.content || this));

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

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

个人对于SAR的粗浅理解

个人对于SAR的粗浅理解 有同学问我是做成像的&#xff0c;让我解释一下SAR成像&#xff0c;我思索了一下&#xff0c;决定这样简单回答&#xff1a; 首先SAR的全称为Synthetic Aperture Radar&#xff0c;即合成孔径雷达&#xff0c;本质还是一种Radar 合成孔径&#xff0c;其…

二叉树刷题总结

题单&#xff1a; 一&#xff0c;相同的树 题目&#xff1a; 给你两棵二叉树的根节点 p 和 q &#xff0c;编写一个函数来检验这两棵树是否相同。 如果两个树在结构上相同&#xff0c;并且节点具有相同的值&#xff0c;则认为它们是相同的。 题目接口&#xff1a; /*** Defin…

STM32实战项目—密码锁

该项目的完整工程可以在博主的资源里找到&#xff0c;仅供参考。 文章目录 一、任务要求二、实现方法2.1 输入密码判断2.2 管理员模式2.3 修改密码 三、程序设计3.1 输入密码判断3.2 进入管理员模式3.3 修改密码 四、问题总结4.1 输入内容一直提示Error4.2 密码判断一直错误 五…

ADB原理,常用命令汇总及示例

一. ADB简介 ADB&#xff0c;即 Android Debug Bridge 是一种允许模拟器或已连接的 Android 设备进行通信的命令行工具&#xff0c;它可为各种设备操作提供便利&#xff0c;如安装和调试应用&#xff0c;并提供对 Unix shell&#xff08;可用来在模拟器或连接的设备上运行各种…

对话小红书剑寒:如何跨方向技术融合,全局优化打造更智能的音视频系统?...

编者按&#xff1a;在 AI 时代&#xff0c;随着 ChatGPT 掀起技术狂潮&#xff0c;构建更智能的音视频系统已经成为音视频领域从业者的共同目标。 然而&#xff0c;音视频系统的智能化&#xff0c;每个从业者对其都有自己独特的视角和理解&#xff0c;正如“一千个人眼中有一千…

基于FreeRTOS的嵌入式设备管理关键技术研究及实现(学习四)

硬件平台 终端设备的硬件选型主要由STM32芯片作为处理器&#xff0c;板载时钟电路和电源电路以及对外通信串口&#xff0c;并挂载AM2302温湿度传感器来实时收集环境相关信息&#xff0c;将收集到的信息通过NB-IoT通信模组上传到云端&#xff0c;从而实现整个环境监测功能。 主…

基于jsp+Servlet+mysql学生信息管理系统V2.0

基于jspServletmysql学生信息管理系统V2.0 一、系统介绍二、功能展示1.项目骨架2.数据库表3.项目内容4.登陆界面5.学生-学生信息6、学生-修改密码7、管理员-学生管理8、管理员-添加学生9.管理员-修改学生信息10.管理员-班级信息11.管理员-教师信息 四、其它1.其他系统实现五.获…

【Linux】LVS负载均衡群集 NAT模式

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 LVS负载均衡群集 NAT模式 一、理解负载均衡群集的原理1.企业群集应用概述2.企业群集分类3.负载均衡群集架构4.负载均衡群集工作模式分析5.NAT模式6.TUN模式7.DR模式 二、LVS虚…

CMU 15-445 -- Tree Indexes - 05

CMU 15-445 -- Tree Indexes - 05 引言Table IndexB TreeB-Tree FamilyB TreeB Tree NodesB Tree OperationsIn Practice Clustered IndexesCompound IndexB Tree Design ChoicesNode SizeMerge ThresholdVariable Length KeysNon-unique IndexesIntra-node Search Optimizatio…

SpringBoot(原理篇)

SpringBoot原理篇 自动配置 bean加载方式 xml方式声明bean 相关类&#xff1a; domain域中的实体类&#xff1a; public class Mouse { }public class Cat { }public class Dog { }测试&#xff1a; public class App1 {public static void main(String[] args) {ClassP…

【hadoop】Linux安装和配置

安装 RedHat Linux 7.4 创建新的虚拟机 选择“自定义&#xff08;高级&#xff09;” 选择“下一步” 选择“稍后安装操作系统” 选择操作系统的类型 设置虚拟机名称和保存路径 下一步 下一步 设置网络类型&#xff0c;选择“使用仅主机模式网络” 下一步 下一步 下一步 设置硬…

Web3本地搭建truffle智能合约开发环境

之前的几篇文章 我们是成功的操作了我们本地区块链的 那么 本文 我们就来说说智能合约 啊 不容易啊 扯了这么久 终于到这了 智能合约是部署在区块链上 不可逆的 一种去中心化的程序&#xff0c;他没有任何第三方公司来管理这个程序和数据 然后 还有就是怎么连接到区块链上的智能…