"use strict";
const common_vendor = require("../../../common/vendor.js");
const _sfc_main = {
  data() {
    return {
      fileUrl: "",
      txtParagraphs: []
    };
  },
  onLoad(options) {
    this.fileUrl = options.filePath;
    common_vendor.index.setNavigationBarTitle({
      title: "文档"
    });
    common_vendor.index.setNavigationBarColor({
      frontColor: "#000000",
      // 必写项，字体颜色仅支持#ffffff和#000000
      backgroundColor: "#F0F0F0",
      // 传递的颜色值，仅支持十六进制颜色
      animation: {
        // 可选项
        duration: 500,
        timingFunc: "easeIn"
      }
    });
    this.readTxt();
  },
  methods: {
    readTxt() {
      const _self = this;
      const fs = common_vendor.index.getFileSystemManager();
      fs.readFile({
        filePath: _self.fileUrl,
        encoding: "utf8",
        success: (readRes) => {
          const fileContent = readRes.data;
          const paragraphs = fileContent.split("\n\n").map((p) => p.trim()).filter((p) => p);
          _self.txtParagraphs = paragraphs;
          common_vendor.index.__f__("log", "at pages/common/readTxt/readTxt.vue:49", _self.txtParagraphs);
        },
        fail: (readErr) => {
          common_vendor.index.__f__("error", "at pages/common/readTxt/readTxt.vue:52", "读取txt文件内容失败：", readErr);
        }
      });
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: $data.txtParagraphs != null && $data.txtParagraphs.length > 0
  }, $data.txtParagraphs != null && $data.txtParagraphs.length > 0 ? {
    b: common_vendor.f($data.txtParagraphs, (item, index, i0) => {
      return {
        a: common_vendor.t(item),
        b: index
      };
    })
  } : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
tt.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-toutiao/pages/common/readTxt/readTxt.js.map
