html科学计算器,vue.js实现的经典计算器/科学计算器功能示例

本文展示了如何使用Vue.js实现一个经典和科学模式的计算器。包括HTML布局、CSS样式和JavaScript逻辑,支持基本运算、平方根、指数、对数、三角函数等科学计算功能。
摘要由CSDN通过智能技术生成

本文实例讲述了vue.js实现的经典计算器/科学计算器功能。分享给大家供大家参考,具体如下:

1. HTML部分:

Show Advanced Mode ⚈

Show Basic Mode ⚆

7

8

9

*

<=

C

4

5

6

/

(

)

1

2

3

-

x 2

±

0

.

%

+

=

sin

cos

tan

x^

<=

C

log

ln

e

°

rad

7

8

9

/

x 2

x !

4

5

6

*

(

)

1

2

3

-

%

±

0

.

π

+

=

2. css部分:

body {

background: linear-gradient(to right, #85D8CE, #085078);

}

#app {

font-family: 'Avenir', Helvetica, Arial, sans-serif;

-webkit-font-smoothing: antialiased;

-moz-osx-font-smoothing: grayscale;

text-align: center;

color: #2c3e50;

display: flex;

flex-wrap: wrap;

justify-content: center;

align-item: center;

}

.calculator {

width: 440px;

padding: 20px;

border-radius: 5px;

margin: 20px auto;

font-size: 16px;

background-color: #333333;

}

.input {

width: 420px;

height: 50px;

border-radius: 0px;

border: 1px solid black;

background-color: #333333;

color: #d9d9d9;

padding: 0 5px 0 5px;

margin: 0 0px 10px 0px;

font-size: 30px;

}

.input:focus,

.input:active {

border-color: #03a9f4;

box-shadow: 0 0 4px #03A9F4;

outline: none 0;

}

.button {

margin: 3px;

width: 63px;

border: 1px solid #0d0d0d;

height: 30px;

border-radius: 4px;

color: #d9d9d9;

background-color: #1a1a1a;

cursor: pointer;

outline: none;

}

.mode {

display: flex;

flex-wrap: wrap;

justify-content: space-evenly;

}

.equal-sign {

background-color: green;

width: 133px;

}

.toggle-button {

border: none;

background-color: #333333;

cursor: pointer;

outline: none;

font-size: 1rem;

color: #fff;

text-shadow: -1px -1px 0 rgba(0, 0, 0, 0.35);

}

p {

margin-top: 0;

}

button::-moz-focus-inner {

border-color: transparent;

}

3. js部分:

let app &

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值