摘要: // 入口文件 import Vue from 'vue' // 配置vuex的步骤 // 1. 运行 cnpm i vuex -S // 2. 导入包 import Vuex from 'vuex' // 3. 注册vuex到vue中 Vue.use(Vuex) // 4. new Vuex.St 阅读全文
posted @ 2019-03-04 22:30 lujieting0 阅读(157) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2019-03-04 22:30 lujieting0 阅读(767) 评论(0) 推荐(0) 编辑
摘要: const fs = require('fs') function getFileByPath(fpath) { return new Promise(function (resolve, reject) { fs.readFile(fpath, 'utf-8', (err, dataStr) => 阅读全文
posted @ 2019-03-04 22:29 lujieting0 阅读(289) 评论(0) 推荐(0) 编辑
摘要: // 1. Promise 是一个 构造函数,既然是构造函数, 那么,我们就可以 new Promise() 得到一个 Promise 的实例; // 2. 在 Promise 上,有两个函数,分别叫做 resolve(成功之后的回调函数) 和 reject(失败之后的回调函数) // 3. 在 P 阅读全文
posted @ 2019-03-04 22:29 lujieting0 阅读(232) 评论(0) 推荐(0) 编辑
摘要: // 需求:你要封装一个方法,我给你一个要读取文件的路径,你这个方法能帮我读取文件,并把内容返回给我 const fs = require('fs') const path = require('path') function getFileByPath(fpath, succCb, errCb) 阅读全文
posted @ 2019-03-04 22:28 lujieting0 阅读(302) 评论(0) 推荐(0) 编辑
摘要: // 需求:你要封装一个方法,我给你一个要读取文件的路径,你这个方法能帮我读取文件,并把内容返回给我 const fs = require('fs') const path = require('path') // 这是普通读取文件的方式 /* fs.readFile(path.join(__dir 阅读全文
posted @ 2019-03-04 22:28 lujieting0 阅读(831) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv 阅读全文
posted @ 2019-03-04 22:27 lujieting0 阅读(133) 评论(0) 推荐(0) 编辑