在本地C盤新建configure.txt文件兼蕊,調用以下返回的就是文件內容,根據(jù)需要在處理數(shù)據(jù)治专,篩選自己想要的部分
// 讀取客戶端配置文件
getConfigContent(){
let result = "";
//創(chuàng)建對象實例
try {
let fileSystemObj = new ActiveXObject("Scripting.FileSystemObject");
if (fileSystemObj.FileExists("c://configure.txt")) {
// 打開文件
let fileTxt = fileSystemObj.OpenTextFile("c://configure.txt");
// 讀取文件一行內容到字符串
result = fileTxt.ReadLine();
// 關閉文件
fileTxt.Close();
}
} catch (e) {
// 此處使用的element的消息提示組件
this.$message.error(
"請使用ie11瀏覽器,或請設置瀏覽器的安全設置,啟用對未標記為可安全執(zhí)行腳本的ActiveX控件初始化并執(zhí)行腳本贯吓!",
);
}
return result;
}