1、Math.round() “四舍五入”, 该函数返回的是一个四舍五入后的的整数12345678double d = 3.1415926;double d2 = 18.58;double d3 = -15.23;double d4 = -16.85;long round1 = Math.round(d); // 结果 3long round2 = Math.round(d2); // 结果 19long round3 = Math.round(d3); // 结果 -15long round4 = Math.round(d4); // 结果 -17 当小数点第一位=5是,这时要注意正负数的结果。例如 double d5 = -16.5; double d6 = 16.5; long round5 = Math.round(d5); // 结果 -16 long round6 = Math.round(d6); // 结果 17 总结:负数,小数点第一位是5时,直接舍去,整数部分不 +1; 正数,小数点第一位是5时,往整数部分 ...
问题相信很多人在用Vue使用别人的组件时,会用到 Vue.use() 。例如:Vue.use(VueRouter)、Vue.use(MintUI)。但是用 axios时,就不需要用 Vue.use(axios),就能直接使用。那这是为什么呐? 答案因为 axios 没有 install。 什么意思呢?接下来我们自定义一个需要 Vue.use() 的组件,也就是有 install 的组件,看完之后就明白了。 定义组件 生成模版 vue init webpack-simple custom-global-component custom-global-component 为新建的文件夹名称 然后一路回车 cd custom-global-component 进入该文件夹 npm install 安装本次需要的模块 npm run dev 运行项目 如果能正常打开,进行下一步 这是当前项目目录: 1.创建如下图中的文件夹和文件 2.在 Loading.vue 中定义一个组件 12345<template> <div class="loading-bo ...
出现原因运行 npm i 安装依赖,报错 ERESOLVE unable to resolve dependency tree 错误原因等依赖项中存在无法解决的冲突,npm@7 现在尝试安装它们,而npm@6没有。 解决方案使用 npm i --legacy-peer-deps 参考点击前往
html页面如何实现中英文切换Demo.js如下: 1234567891011121314151617181920212223242526272829303132333435363738394041<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>中英转换</title> <script type="text/javascript" src="js/language.js&qu ...
ButtonInline12This is my website, click the button {% btn 'https://butterfly.js.org',Butterfly %}This is my website, click the button {% btn 'https://butterfly.js.org',Butterfly,,outline%} This is my website, click the button Butterfly This is my website, click the button Butterfly Block123This is my website, click the button {% btn 'https://butterfly.js.org',Butterfly,far fa-hand-point-right,block larger %}This is my website, click t ...
hover时背景颜色从内向外辐射改变css,代码如下。 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</ti ...
js自动生成手机扫描二维码就可以实现自动下载apk的二维码js自动生成手机扫描二维码就可以实现自动下载apk的二维码 代码如下: 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko"><head> <title>Javascript 二维码生成库:QRCode</title> <meta htt ...
uni-app的基本使用课程介绍: 基础部分: 环境搭建 页面外观配置 数据绑定 uni-app的生命周期 组件的使用 uni-app中样式学习 在uni-app中使用字体图标和开启scss 条件注释跨端兼容 uni中的事件 导航跳转 组件创建和通讯,及组件的生命周期 uni-app中使用uni-ui库 项目:黑马商城项目 uni-app介绍 官方网页uni-app 是一个使用 Vue.js 开发所有前端应用的框架,开发者编写一套代码,可发布到iOS、Android、H5、以及各种小程序(微信/支付宝/百度/头条/QQ/钉钉)等多个平台。 即使不跨端,uni-app同时也是更好的小程序开发框架。 具有vue和微信小程序的开发经验,可快速上手uni-app 为什么要去学习uni-app? 相对开发者来说,减少了学习成本,因为只学会uni-app之后,即可开发出iOS、Android、H5、以及各种小程序的应用,不需要再去学习开发其他应用的框架,相对公司而言,也大大减少了开发成本。 环境搭建安装编辑器HbuilderX 下载地址 HBuilderX是通用的前端开发工具,但为uni ...
WXML123456789<swiper class="swiper_container" vertical="true" autoplay="true" circular="true" interval="1000"><block wx:for="{{msgList}}"><navigator url="/pages/index/index?title={{item.url}}" open-type="navigate"><swiper-item><view class="swiper_item">{{item.title}}</view></swiper-item></navigator> ...
本文将简单介绍如何实现微信小程序的下拉刷新将要使用的api: wx.showNavigationBarLoading(Object object) wx.showLoading(Object object) wx.hideLoading(Object object) wx.hideNavigationBarLoading(Object object) wx.stopPullDownRefresh(Object object) wx.request(Object object) 1234567891011121314151617181920212223242526272829303132//刷新onRefresh(){ //在当前页面显示导航条加载动画 wx.showNavigationBarLoading(); //显示 loading 提示框。需主动调用 wx.hideLoading 才能关闭提示框 wx.showLoading({ title: '刷新中...', }) t ...
公告
博客微信小程序版已上线,同步更新,请扫码浏览。🎉