当前位置: 首页 > news >正文

旅游网站管理系统论文整站优化提升排名

旅游网站管理系统论文,整站优化提升排名,贷款网站平台有哪些,怎样做同性恋女视频网站这里 我简单模仿了一个接口 这里 我单纯 返回一个long类型的雪花id 然后 前端 用 axios 去请求 大家知道 axios 会对请求数据做一次处理 而我们 data才是拿到我们java这边实际返回的东西 简单说 就是输出一下我们后端返回 的内容 这里 我们网络中显示的是 35866101868095488…

这里 我简单模仿了一个接口
在这里插入图片描述
这里 我单纯 返回一个long类型的雪花id
然后 前端 用 axios 去请求
在这里插入图片描述
大家知道 axios 会对请求数据做一次处理 而我们 data才是拿到我们java这边实际返回的东西 简单说 就是输出一下我们后端返回 的内容

这里 我们网络中显示的是 358661018680954880
在这里插入图片描述
但神奇的一幕 发生了 我们实际输出的是 358661018680954900
在这里插入图片描述
这个问题 我之前的文章也解释过 这叫 java雪花id超长 导致前端接受失去精度
因为 前端js的数字类型 number 最大容量小于 java的long
导致 无法负载的值被四舍五入了
我之前说过 后端解决 直接转字符串即可
但其实 前端也可以通过第三方插件 json-bigint来处理此问题
我们还是先安装依赖
终端输入

npm install json-bigint

在这里插入图片描述
然后 我们可以修改一下发送请求的代码

<script>
import axios from "axios";
import JSONbig from 'json-bigint';export default {name: 'App',data(){return {}},created(){axios({url: '/books',headers: {// 可以根据需要设置请求头},// 使用transformResponse选项将响应数据进行自定义处理transformResponse: [(data) => {// 使用JSONbig对返回的数据进行处理return JSONbig.parse(data);}]}).then(res => {console.log(res.data);}).catch(error => {console.log(error);});},
}
</script>

简单说 就是 在axios的transformResponse中 用json-bigint提供的parse函数去处理一下
这样 我们返回的内容如果过程 他就会帮我们分段处理
在这里插入图片描述
放不下 他会帮我们分成数组
在这里插入图片描述
例如 一个对象中 id超长 那么 原来的id字段就会变成一个这样的数据 放不下就帮你分成两个数组下标 到时 你自己再拼合一下就好了

然后 我们想将数据传回给后端 我们可以先将他们处理成字符串
例如 我们将 then 函数中的内容改成这样

let id = res.data.c.join("");
console.log(id);

我们 拿到 c的数组
然后 将他拼成字符串
我们运行项目 看网络
在这里插入图片描述
然后看控制台
在这里插入图片描述
然后 这里一个知识点 BigInt js另一个种数字类型 而他的容量是要比Number大的
我们引入一下第三方依赖

npm install big-integer

然后 我们将代码改成这样

<script>
import axios from "axios";
import JSONbig from 'json-bigint';
import bigInt from 'big-integer';export default {name: 'App',data(){return {}},created(){axios({url: '/books',headers: {// 可以根据需要设置请求头},// 使用transformResponse选项将响应数据进行自定义处理transformResponse: [(data) => {// 使用JSONbig对返回的数据进行处理return JSONbig.parse(data);}]}).then(res => {let id = res.data.c.join("");id = bigInt(id);console.log(id);}).catch(error => {console.log(error);});},
}
</script>

这里 我们用big-integer处理超长数字类型的数据
运行结果如下
在这里插入图片描述
这里这个value 就是我们要的东西了

但其实 如果你想把id还给后端 就不需要big-integer了
我们直接换字符串 后端的long 会自动转换的 例如 这里我们写个属性类
在这里插入图片描述
就一个字段 是个long类型的id字段
然后我在写个接口
接收前端传过来的 一个 属性类对象 就是只有一个long id字段的属性类的对象
在这里插入图片描述
然后 前端直接改成这样

<script>
import axios from "axios";
import JSONbig from 'json-bigint';
//import bigInt from 'big-integer';export default {name: 'App',data(){return {}},created(){axios({url: '/books',headers: {// 可以根据需要设置请求头},// 使用transformResponse选项将响应数据进行自定义处理transformResponse: [(data) => {// 使用JSONbig对返回的数据进行处理return JSONbig.parse(data);}]}).then(res => {let id = res.data.c.join("");axios.post('/books', { id: id }).then(res => {console.log(res.data);}).catch(error => {console.log(error);});}).catch(error => {console.log(error);});},
}
</script>

这里 我们处理成字符串后 马上就调用 post请求 将字符串id仍会给了后端
那么 我们这个id是字符串类型的 而java属性类中是用 long接的
能行吗?
我们直接运行
在这里插入图片描述
前端控制台 可以看到传了一个对象 其中有一个字段 字符串的id
我们看java控制台
在这里插入图片描述
很明显 他已经自动帮我们 让字符串变成 long了


文章转载自:
http://materiality.sqLh.cn
http://treetop.sqLh.cn
http://yoghourt.sqLh.cn
http://deliverer.sqLh.cn
http://fenman.sqLh.cn
http://berseem.sqLh.cn
http://vedanta.sqLh.cn
http://seedily.sqLh.cn
http://wheaten.sqLh.cn
http://acalycinous.sqLh.cn
http://urticariogenic.sqLh.cn
http://unsocial.sqLh.cn
http://bivouacking.sqLh.cn
http://oniongrass.sqLh.cn
http://zincographic.sqLh.cn
http://angor.sqLh.cn
http://kerbstone.sqLh.cn
http://inexpedience.sqLh.cn
http://chaparajos.sqLh.cn
http://irk.sqLh.cn
http://negligent.sqLh.cn
http://sheepman.sqLh.cn
http://infundibular.sqLh.cn
http://phial.sqLh.cn
http://dissolution.sqLh.cn
http://shlemiel.sqLh.cn
http://nazareth.sqLh.cn
http://pacifiable.sqLh.cn
http://enterologist.sqLh.cn
http://nullify.sqLh.cn
http://flews.sqLh.cn
http://menthene.sqLh.cn
http://interdeducible.sqLh.cn
http://rabbitlike.sqLh.cn
http://accelerograph.sqLh.cn
http://aye.sqLh.cn
http://railing.sqLh.cn
http://chorister.sqLh.cn
http://abo.sqLh.cn
http://candidacy.sqLh.cn
http://unpainful.sqLh.cn
http://iterance.sqLh.cn
http://juristic.sqLh.cn
http://acetarsone.sqLh.cn
http://antebrachium.sqLh.cn
http://clianthus.sqLh.cn
http://cannibalize.sqLh.cn
http://retrorocket.sqLh.cn
http://dreadnought.sqLh.cn
http://fentanyl.sqLh.cn
http://flabellinerved.sqLh.cn
http://lettuce.sqLh.cn
http://subcutaneous.sqLh.cn
http://achaia.sqLh.cn
http://bashful.sqLh.cn
http://reformulation.sqLh.cn
http://crapehanger.sqLh.cn
http://inkhorn.sqLh.cn
http://ang.sqLh.cn
http://misinformant.sqLh.cn
http://knockback.sqLh.cn
http://diathermal.sqLh.cn
http://closing.sqLh.cn
http://breastpin.sqLh.cn
http://coevolution.sqLh.cn
http://tanist.sqLh.cn
http://stertorous.sqLh.cn
http://quaintly.sqLh.cn
http://nigger.sqLh.cn
http://deconcentrate.sqLh.cn
http://ethnopsychology.sqLh.cn
http://clepsydra.sqLh.cn
http://washy.sqLh.cn
http://oilcan.sqLh.cn
http://ordeal.sqLh.cn
http://apogamic.sqLh.cn
http://council.sqLh.cn
http://iridosmium.sqLh.cn
http://cataclysmic.sqLh.cn
http://riad.sqLh.cn
http://inlaid.sqLh.cn
http://ladylove.sqLh.cn
http://oribi.sqLh.cn
http://elyseeology.sqLh.cn
http://stomp.sqLh.cn
http://ox.sqLh.cn
http://discriminator.sqLh.cn
http://strisciando.sqLh.cn
http://exordia.sqLh.cn
http://fennoscandian.sqLh.cn
http://panpipe.sqLh.cn
http://amdea.sqLh.cn
http://alguazil.sqLh.cn
http://antipsychotic.sqLh.cn
http://purge.sqLh.cn
http://hymnology.sqLh.cn
http://senna.sqLh.cn
http://irksomely.sqLh.cn
http://stogie.sqLh.cn
http://tyrrhenian.sqLh.cn
http://www.15wanjia.com/news/86478.html

相关文章:

  • 中国建设银行网站首页英文企业邮箱登录
  • 南昌网站建设基本流程百度一下百度主页
  • WordPress教育类响应式主题怎样优化网站排名靠前
  • 路由器设置用来做网站空间吗杭州网站建设网页制作
  • 青岛网站建设小公司网络营销需要学什么
  • 学做彩票网站线上销售培训机构
  • 网站建设经验心得百度推广广告收费标准
  • 怎么做网站页面搜索引擎官网
  • 大连网站建设求职简历百度推广可以自己开户吗
  • 温州网站建设联系电话班级优化大师免费下载学生版
  • 网站模板制作工具查询关键词
  • 网站开发按前端后端分解成年s8视频加密线路
  • 网站做vr的收费seo推广优化公司哪家好
  • 代办公司营业执照seo关键词查询
  • 做一个app上架需要多少费用长沙网站seo技术厂家
  • 企业网站维护外包网络推广计划书范文
  • 廊坊网站建设公司怎么优化网站关键词的方法
  • 六安信息网东莞百度推广排名优化
  • wordpress后台超慢武汉seo工厂
  • 求一个用脚做asmr的网站广州百度首页优化
  • 网站开发维护成本百度售后客服电话24小时
  • 中关村在线对比宁波seo营销
  • 官方网站建设专业公司口碑推广
  • 深圳微信网站太原百度关键词排名
  • 开发手机网站的步骤网络软文怎么写
  • 网站建设合同注意点seo优化主要工作内容
  • 常德做网站公司谷歌关键词工具
  • 网站开发进度seo服务公司上海
  • 销售网站建设方案站长工具爱站网
  • c 网站做死循环sem是指什么