递归map

1 2 3 4 5 6 7 8 9 const criteria = {"operator":"and","values":[{"operator":"and","values":[{"operator":"and","values":[{"operator":"and","values":[{"operator":"and","values":[],"uid":"1593264704"},{"operator":"and","values":[],"uid":"283583839"}],"uid":"306590514"},{"operator":"and","values":[],"uid":"1899400818"},{"operator":"and","values":[],"uid":"1809313610"}],"uid":"966087239"},{"operator":"and","values":[],"uid":"586805392"},{"operator":"and","values":[],"uid":"820862889"},{"operator":"and","values":[],"uid":"1622114136"}],"uid":"1198153895"},{"operator":"and","values":[{"operator":"and","values":[],"uid":"2096355855"},{"operator":"and","values":[],"uid":"360825872"}],"uid":"898380472"},{"operator":"and","values":[],"uid":"134584530"}],"uid":"913669697"} const mapHandler = (i) => i.values.map(mapHandler); let values = criteria.values.map(mapHandler); values = flattenDeep(values) if (values.length === 0) { criteriaStr = ''; criteria.values = []; }

Vitejs

# npm 6.x npm create [email protected] my-vue-app --template vue # npm 7+, extra double-dash is needed: npm create [email protected] my-vue-app -- --template vue # yarn yarn create vite my-vue-app --template vue # pnpm pnpm create vite my-vue-app --template vue 模板:……

Go-Image-Png

1 func Decode(r io.Reader) (image.Image, error) 将png图片解码为 Image 数据,要先png图片文件搞到Reader中,在从Re……

Go-Template

解析模板文件并绑定方法和数据 1 2 3 4 5 6 7 8 func view(w http.ResponseWriter, r *http.Request) { funcMap := template.FuncMap{"minus": func(a int, b int){ return a - b }} temp, _……