2022-05-30 13:29:40    7    0    0
### **1.拉取oracle镜像**
2021-12-30 07:43:37    2    0    0

html转换成AST

想要的效果

  1. 输入: let str ="<div><span>tests</span></div>"
  2. 输出 : {
  3. tag: 'div',
  4. children: [
  5. {
  6. tag: 'span'
  7. },
  8. ],
  9. }

实现

  1. // 设置每个节点标签属性
  2. // let attrRE = /\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;
  3. function parseTag(tag) {
  4. let res = {
  5. type: "tag",
  6. name: "",
  7. voidElement: false,
  8. attrs: {},
  9. children: [],
  10. };
  11. let tagMatch = tag.match(/<\/?([^\s]+?)[/\s>]/);
  12. if (tagMatch) {
  13. // 标签名称为正则匹配的第2项
  14. res.name = tagMatch[1];
  15. if (tag.charAt(tag.length - 2) === "/") {
  16. // 判断tag字符串倒数第二项是不是 / 设置为空标签。 例子:<img/>
  17. res.voidElement = true;
  18. }
  19. }
  20. // 匹配所有的标签正则
  21. let classList = tag.match(/\s([^'"/\s><]+?)\s*?=\s*?(".*?"|'.*?')/g);
  22. if (classList && classList.length) {
  23. for (let i = 0; i < classList.length; i++) {
  24. // 去空格再以= 分隔字符串 得到['属性名称','属性值']
2021-09-02 09:15:44    14    0    0

build.sh

  1. #!/bin/bash
  2. ## ======= 批量打包 ======= ##
  3. RED_COLOR='\E[1;31m **********'
  4. GREEN_COLOR='\E[1;32m **********'
  5. YELLOW_COLOR='\E[1;33m **********'
  6. BLUE_COLOR='\E[1;34m **********'
  7. RES='********** \E[0m'
  8. y_dev="dev-20210420"
  9. y_master="master"
  10. h_dev="dev-20210804-haopinzhongguo"
  11. h_master="master-haopingzhongguo"
  12. fileName="admin"
  13. distPath="/c/Users/Administrator/Desktop/云仓前端包"
  14. [ $2 ] && distPath=$2
  15. buildType=$1
  16. successArr=()
  17. log() {
  18. case $1 in
  19. red)
  20. echo -e "\n${RED_COLOR}$2${RES}"
  21. ;;
  22. green)
  23. echo -e "\n${GREEN_COLOR}$2${RES}"
  24. ;;
  25. yellow)
  26. echo -e "\n${YELLOW_COLOR}$2${RES}"
  27. ;;
  28. blue)
  29. echo -e "\n${BLUE_COLOR}$2${RES}"
  30. ;;
  31. *)
  32. echo -e "\n**********$2**********"
  33. ;;
  34. esac
  35. }
  36. log blue 开始打包
  37. if [[ ! -e $distPath ]]; then
  38. rm -rf $distPath
  39. mkdir $distPath
  40. cd $distPath
  41. mkdir 好品中国测试 好品中国正式 友云正式
  42. cd -
  43. fi
  44. build() {
  45. git checkout $1
  46. git pull origin $1
  47. git
2021-09-02 09:13:21    21    0    0

忽略commit message, 后面加上--no-edit

git pull --no-edit
git merge dev --no-edit

2021-09-01 02:29:09    7    0    0
  1. 网站下载zip(zip-3.0-bin.zip)bzip2(bzip2-1.0.5-bin.zip)两个文件
  2. 解压两个文件夹到C盘根目录下
  3. zip的找到bin下面的zip.exe并复制到gitbash的安装目录的bin目录下(windows: where git), 在bzip2解压目录下的bin下,找到bzip2.dll,复制到git/user/bin目录下
  4. 添加环境变量(可选步骤):
    • 环境变量 -> 系统变量 -> PATH新增两个文件下的bin路径, 如: zipC:\zip-3.0-bin\binbzip2C:\bzip2-1.0.5-bin\bin
2021-08-31 06:46:28    5    0    0
  1. let name = ""
  2. try {
  3. const file = require(`@/views${ route.path }.vue`)
  4. const componentName = file.default.name
  5. if (componentName) {
  6. name = componentName
  7. } else {
  8. throw Error("Fail: Don't Find 'name', src: '" + route.path + "'")
  9. }
  10. } catch (err) {
  11. // console.log(777777777, err)
  12. const nameArr = route.path.split("/")
  13. let setName = replaceReg(nameArr[nameArr.length - 1])
  14. if (setName.length < 6 && nameArr[nameArr.length - 2]) {
  15. name = replaceReg(nameArr[nameArr.length - 2]) + setName
  16. }
  17. }
2021-08-16 10:27:26    8    0    0

嵌套路由里的子路由跳转会触发父路由的生命周期

注意: 是否在里使用了:key, key如果不一样会每次都触发更新

2021-07-27 09:10:55    4    0    0
  1. var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]
  2. function promiseForEach(arr, cb) {
  3. let realResult = []
  4. let result = Promise.resolve()
  5. arr.forEach((a, index) => {
  6. result = result.then(() => {
  7. if (typeof cb === "function") {
  8. return cb(a).then((res) => {
  9. realResult.push(res)
  10. })
  11. }
  12. })
  13. })
  14. return result.then(() => {
  15. return realResult
  16. })
  17. }
  18. promiseForEach(arr, (ele) => {
  19. return new Promise((resolve, reject) => {
  20. setTimeout(() => {
  21. console.log(ele)
  22. return resolve(ele)
  23. }, Math.random() * 1000)
  24. })
  25. }).then((data) => {
  26. console.log("成功")
  27. console.log(data)
  28. }).catch((err) => {
  29. console.log("失败")
  30. console.log(err)
  31. })
2021-07-14 02:24:29    17    0    0

使用一个空白页来中转

  1. // refresh.vue
  2. <template>
  3. <div></div>
  4. </template>
  5. <script>
  6. export default {
  7. name: "refresh",
  8. data() {
  9. return {}
  10. },
  11. beforeRouteEnter(to, from, next) {
  12. next(vm => {
  13. vm.$router.replace({ path: from.path, query: to.query })
  14. })
  15. }
  16. }
  17. </script>
  18. // router.vue
  19. {
  20. path: "/refresh",
  21. name: "refresh",
  22. component: () =>
  23. import(/* webpackChunkName: "page" */ "@/components/refresh"),
  24. meta: {
  25. keepAlive: false,
  26. isTab: false,
  27. isAuth: false
  28. }
  29. }
  30. // main.js (如果需要设置所有的)
  31. router.beforeEach((to, from, next) => {
  32. if (from.path === to.path) {
  33. next({ path: "/refresh", query: to.query })
  34. return
  35. }
  36. }
2021-06-21 09:36:07    4    0    0
4/18