logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

【Vue3】保留小数点位数以及转化为百分比

toFixed MDNtoFixed() 方法使用定点表示法来格式化一个数值。一、保留小数点后两位四舍五入export function NumFilter (value) {// 截取当前数据到小数点后两位let realVal = parseFloat(value).toFixed(2)return realVal}二、保留两位小数不四舍五入export function numFilter

#javascript#前端#vue.js
【Vue3】实现动态给id赋值,点击事件获取当前点击的元素的id操作

场景需要让输出的 id 为 0,1……代码<div v-for="(item,index) in list" :key="index" ><div :id="index" @click="b(index)">我是id</div></div>然后在 vue 的实例中就可以拿到对应的 idb(index){this.list.splice(index,1

#前端#javascript#开发语言
【Vue3】vite 配置IP,解决“vite use `--host` to expose”

问题描述vite 启动后出现 “ Network: use --host to expose ”vite v2.3.7 dev server running at:> Local: http://localhost:3000/> Network: use `--host` to expose原因分析这是因为IP没有做配置,所以不能从IP启动,需要在 vite.config.js做相应配

#tcp/ip#vue.js#前端
【Vue3】axios 封装

首先,在项目 src 目录下新建一个 config 文件夹,并在该文件夹下新建一个 index.js:// index.jsexport default {development: {baseUrl: 'http://xxx.xxx.xxx.xxx:xxxx' // 测试接口域名},beta: {baseUrl: 'http://xxx.xxx.xxx.xxx:xxxx' // 测试接口域名},r

#javascript#前端#node.js
【MySQL】数据表自动生成ER图

环境mysql workbench步骤通过菜单栏 ”Database”,选择“Reverse Engineer…”,输入连接信息,并一路Next;选择要生成ER图的数据库:一路Next,最后excute和close;可以看到,在ERR Diagram区域多了一张图,点击它,就看到了自己想要的ER图了:导出到图片:...

#mysql#数据库#database
【Vue3】使用reactive包裹数组赋值

需求将接口请求到的列表数据赋值给响应数据arr代码const arr = reactive([]);const load = () => {const res = [2, 3, 4, 5]; //假设请求接口返回的数据// 方法1 失败,直接赋值丢失了响应性// arr = res;// 方法2 这样也是失败// arr.concat(res);// 方法3 可以,但是很麻烦res.forE

#前端#vue.js#javascript
【Html】解决 button 按钮点击后自动刷新页面的问题

问题页面上有一个查询按钮为 Button 标签,点击查询按钮后会自动刷新页面,令人费解,查资料后发现是 button 的默认行为导致的。<button class="btn btn-default active" id="btnAdd" click="selectData()">查询</button>原因button,input type=button 按钮在 IE 和 w

#html#firefox#前端
【Vue3】跨域问题 [The value of the ‘Access-Control-Allow-Origin‘ header in the response must not be the..]

场景vue 项目中 axios 请求数据的时候请求失败,出现跨域问题。报错信息The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard解决方法withCredentials 属性CORS 请求默认不发送 Cookie 和 HTTP 认证信息。如果要把 Cookie 发

#前端#vue.js#javascript
到底了