限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

基于Vue.js科学型计算器实用工具

所属分类: 网页特效-实用工具    2024-12-06 03:35:56

基于Vue.js科学型计算器实用工具 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

基于Vue.js科学型计算器实用工具(共5个文件)

    • index.html

使用方法

'use strict';

var app = new Vue({
  el: '#app',
  data: function data() {
    return {
      current: '',
      changeMode: true
    };
  },

  methods: {
    press: function press(event) {
      var me = this;
      var key = event.target.textContent;

      if (key != '=' && key != 'C' && key != '*' && key != '/' && key != '√' && key != "x ²" && key != "%" && key != "<=" && key != "±" && key != "sin" && key != "cos" && key != "tan" && key != "log" && key != "ln" && key != "x^" && key != "x !" && key != "π" && key != "e" && key != "rad" && key != "∘") {
        me.current += key;
      } else if (key === '=') {

        if (me.current.indexOf('^') > -1) {
          var base = me.current.slice(0, me.current.indexOf('^'));
          var exponent = me.current.slice(me.current.indexOf('^') + 1);
          me.current = eval('Math.pow(' + base + ',' + exponent + ')');
        } else {
          me.current = eval(me.current);
        }
      } else if (key === 'C') {

        me.current = '';
      } else if (key === '*') {

        me.current += '*';
      } else if (key === '/') {

        me.current += '/';
      } else if (key === '+') {

        me.current += '+';
      } else if (key === '-') {

        me.current += '-';
      } else if (key === '±') {

        if (me.current.charAt(0) === '-') {
          me.current = me.current.slice(1);
        } else {
          me.current = '-' + me.current;
        }
      } else if (key === '<=') {

        me.current = me.current.substring(0, me.current.length - 1);
      } else if (key === '%') {

        me.current = me.current / 100;
      } else if (key === 'π') {

        me.current = me.current * Math.PI;
      } else if (key === 'x ²') {

        me.current = eval(me.current * me.current);
      } else if (key === '√') {

        me.current = Math.sqrt(me.current);
      } else if (key === 'sin') {

        me.current = Math.sin(me.current);
      } else if (key === 'cos') {

        me.current = Math.cos(me.current);
      } else if (key === 'tan') {

        me.current = Math.tan(me.current);
      } else if (key === 'log') {

        me.current = Math.log10(me.current);
      } else if (key === 'ln') {

        me.current = Math.log(me.current);
      } else if (key === 'x^') {

        me.current += '^';
      } else if (key === 'x !') {

        var number = 1;
        if (me.current === 0) {
          me.current = '1';
        } else if (me.current < 0) {
          me.current = NaN;
        } else {
          var _number = 1;
          for (var i = me.current; i > 0; i--) {
            _number *= i;
          }
          me.current = _number;
        }
      } else if (key === 'e') {

        me.current = Math.exp(me.current);
      } else if (key === 'rad') {

        me.current = me.current * (Math.PI / 180);
      } else if (key === '∘') {

        me.current = me.current * (180 / Math.PI);
      }
    },
    changeModeEvent: function changeModeEvent() {
      var me = this;
      me.changeMode = !me.changeMode;
    }
  }
});

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 实用工具

html5在线可视化流程图简易绘图工具代码

一款在线绘图实用工具插件,可绘制基础的流程图及简单的结构图,很实用!
  实用工具
 6484  0

jquery文本文字符串中自动提取keywords关键字插件

一款自动提取关键词插件,自动忽略掉一些无关紧要的词语,自动提取关键字并列表显示出来,可复制。
  实用工具
 8322  0

jquery页面中添加元素网格辅助对齐线插件

一款基于Bootstrap可扩展的网格辅助线插件,可帮助开发者在网页中精确定位和对齐元素。
  实用工具
 8314  0

jquery页面右下角浮动的whatsapp点击聊天插件

一个浮动和可自定义的Whatsapp按钮,鼠标悬停于按钮上,可触发弹出聊天对话窗口,可通过Whatsapp点击聊天。
  实用工具
 1822  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论