<template> <view class="u-wrap"> <view class="u-search-box"> <view class="u-search-inner"> <u-icon name="search" color="#909399" :size="28"></u-icon> <text class…
<template> <view class="u-wrap"> <view class="u-search-box"> <view class="u-search-inner"> <u-icon name="search" color="#909399" :size="28"></u-icon> <text class…
扁平数组转换为树形结构 这个是最常用的,当我们从后台获取一个扁平数组的时候,通常比如用id、pid来标识父子关系,如: var arr = [{id: 1, pid: '-1'},{id: 11, pid: '1'},{id: 12, pid: '1'}] 用map记录的方法是最常用效果也最好的复杂度是O(nlgn),支持多个根节点: function listToTree(list) { var map = {}, node, tree= [], i; …
问题 微信小程序连接mqtt 模拟器正常使用,真机无法连接,已经配置了服务器域名 基础 服务端使用的是emqx,配置域名代理8083端口 微信小程序需要把wss://xx.xxx.com域名添加后台开发管理->开发设置->服务器域名,socket合法域名中 提示 由于微信小程序的规范限制,EMQX 使用微信小程序接入时需要注意以下几点: 必须使用已经通过域名备案 (opens new window)的域名接入 域名需要在小程序管理后台 (opens new window)域名/IP 白名单中(开发 -&…
/** * 分组切分数组,一维数组变为二位数组 * @param data * @param size 切分个数 * @returns {*[]} */ splitArray(data, size) { const groupedData = []; for (let i = 0; i < data.length; i += size) { let end = i + size; if (end > data.length) { end = data.length; } groupedData.push…
新建comm.scss文件 @mixin flex($direction: row, $justify-content: center, $align-items: center) { display: flex; flex-direction: $direction; justify-content: $justify-content; align-items: $align-items; } 然后,在你的主Sass文件中,使用@include引入 flex .selector { @include flex(r…
问题 当你写完多个页面,exoprt静态页面后,放在服务器上直接访问某个子页面****,发现直接访问给你返回了个404,你去查看目录结构,发现nextjs工具给你生成了register.html。而不是/register/index.html。自然会返回404 解决办法 官方文档也有提及 修改next.config.js 。添加 exportTrailingSlash: true module.exports = withLess({ exportTrailingSlash: true, // make /abo…
在根目录下添加 .editorconfig 文件: # EditorConfig is awesome: https://EditorConfig.org # top-most EditorConfig file root = true [*] indent_style = space indent_size = 2 end_of_line = lf charset = utf-8 trim_trailing_whitespace = false insert_final_newline = false 安装 es…
字符串截取,通过url获取参数 function getUrl(url){ let arr = url.split('?'); let params = arr[1].split('&'); let obj = {}; for(let i=0;i<params.length;i++){ let param = params[i].split('='); obj[param[0]] = par…
ts const Logs = { /** * 成功 * @param val * @param title */ success(val: any, title?: string) { console.log(`%c ${title || 'success'}: `, 'color: #67C23A; font-weight: bold', val); }, /** * 失败 * @param val * @param title */ error(val: any, ti…
遇到的问题 我用vue-cli5创建一个vue3项目(vue-cli默认是webpack集成),想使用路径别名@和跨域proxy。于是我去网站上各种找,最后发现如下方法。 默认vue.config.js代码 const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ transpileDependencies: true, lintOnSave: false }) 解决 删除defineConfig.直接在…