jset编写测试vue代码_视觉完美 四角边框(带圆弧)组件 代码编写和分享 Vue.js...

b413bcc46ed3ca2f97d028f88ba64cad.png

业务场景需要一个边框组件 三角边框和一个角为圆弧的组件

  1. 谷歌了一番 最多的是 四个角为直角 但是业务需求是三个角为直角和一个角为弧形 其余的时候为四个角直角
  2. 最终实现:

5c90748ae6b9084687c06e7c197be7d1.png

3.经过N次修改改成的

方案思路

  1. 一开始看网络上的 发现大部分都是用背景渐变完成的 不行 因为弧形的边框背景渐变无法完成.
  2. 开始使用伪类来解决问题 弧形用图片解决 不行 因为项目是大屏一旦放到大屏上图片弧形的就会出现像素模糊再加上切图困难 放弃
  3. 没办法 只能用 div 解决 弧形就用 border-radius 来解决问题

具体解决

  1. 只能用div做的话 一下子变得简单起来了
  2. 首先我们先做一个div边框作为为外层的边框
  3. 在做四个作为角的边框
  4. 对着四个角用相对路径进行定位
  5. 需要less的calc()方法进行精确计算
  6. 用props进行传值
  7. 用sloit作为内容插槽

需要参数和参数作用

  1. arc: border-radius 边框弯曲弧度 比如你是右下角弯曲就传值 '0 0 20px 0'
  2. arcSrc: 共有 topLeft topRight bottomLeft bottomRight 这些参数 比如你是右下角弯曲就传值 'bottomRight'
  3. colors: 顾名思义这是边框颜色 因为 边框和四个角的颜色不同所以就需要连个颜色 比如内边框为#2d6c90 四角的边框颜色为#153a4f 你应该传值: ['#2d6c90','#153a4f']

完成

具体代码可以点击我的github地址 因为用的是css-model大家可以根据具体业务进行修改 难是不难 主要的是思路~~~

github地址点击

以下是使用NOAA日出日落算法计算日出和日落时间的示例代码: ```python import datetime import math def calculate_julian_day(year, month, day): if month <= 2: year -= 1 month += 12 A = math.floor(year / 100) B = 2 - A + math.floor(A / 4) julian_day = math.floor(365.25 * (year + 4716)) + math.floor(30.6001 * (month + 1)) + day + B - 1524.5 return julian_day def calculate_sunrise_sunset(latitude, longitude, date): julian_day = calculate_julian_day(date.year, date.month, date.day) n = julian_day - 2451545.0 + 0.0008 Jc = n / 36525.0 Jd = 2451545.0 + 0.0009 + Jc M = (357.5291 + 0.98560028 * (Jd - 2451545.0)) % 360 L = (280.46646 + 0.98564736 * (Jd - 2451545.0)) % 360 ec = 0.016708634 - 0.000042037 * Jc C = (1.914602 - 0.004817 * Jc - 0.000014 * Jc**2) * math.sin(math.radians(M)) + (0.019993 - 0.000101 * Jc) * math.sin(math.radians(2 * M)) + 0.000289 * math.sin(math.radians(3 * M)) true_longitude = L + C omega = 125.04 - 1934.136 * Jc lambda_sun = true_longitude - 0.00569 - 0.00478 * math.sin(math.radians(omega)) epsilon = 23.439291 - 0.0130042 * Jc sin_alpha = math.cos(math.radians(epsilon)) * math.sin(math.radians(lambda_sun)) cos_alpha = math.sqrt(1 - sin_alpha**2) alpha = math.degrees(math.atan2(sin_alpha, cos_alpha)) hour_angle = math.degrees(math.acos((math.sin(math.radians(-0.83)) - math.sin(math.radians(latitude)) * math.sin(math.radians(alpha))) / (math.cos(math.radians(latitude)) * math.cos(math.radians(alpha))))) Jtransit = 2451545.0 + 0.0009 + ((hour_angle + longitude) / 360.0) + n delta_Jtransit = Jtransit - math.floor(Jtransit) Jset = Jtransit + (0.0053 * math.sin(math.radians(omega))) - (0.0069 * math.sin(2 * math.radians(lambda_sun))) delta_Jset = Jset - math.floor(Jset) Jrise = Jtransit - delta_Jtransit Jrise_next = Jrise + 1.0 sunrise_time = datetime.datetime.utcfromtimestamp((Jrise - 2451545.0) * 86400.0) sunset_time = datetime.datetime.utcfromtimestamp((Jset - 2451545.0) * 86400.0) return sunrise_time, sunset_time # 示例使用 latitude = 37.7749 # 纬度 longitude = -122.4194 # 经度 date = datetime.datetime(2022, 1, 1) # 日期 sunrise, sunset = calculate_sunrise_sunset(latitude, longitude, date) print("日出时间:", sunrise) print("日落时间:", sunset) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值