利用vue.js实现一款简易计算器可多则混合运算(加减乘除)
vue计算器完整代码如下:
<template>
<view>
<view class="calculatorBox">
<view class="colseImg">
<view class="titPopup">
计算器
</view>
</view>
<view class="calculatorContent">
<view class="ccwindows">
<view class="Exhibition">
<text v-for="(c,i) in CalculatorVal" :key='i'>{
{c==='/'?'÷':c==='*'?'×':c}}</text>
</view>
<view class="CalculatorRst">
{
{CalculatorValRst}}
</view>
</view>
<view class="ccoperation">
<view class="calculatorContentLet">
<view class="numkeys">
<view class="ccitem" v-for="(citem,cindex) in [7,8,9,4,5,6,1,2,3]" :key="cindex" @click="inputValFn(citem)">
{
{citem}}
</view>
</view>
<view class="numkeysBottom numkeys">
<view class="ccitem2" v-for="(citem2,cindex2) in ['.',0]" :key='cindex2' @click="inputValFn(citem2)">
{
{citem2}}
</view>
<view class="ccitem2" @click="calculatorDel">
删除
</view>
<view class="ccitem2" @click="calculatorEmpty">
清空
</view>
</view>
</view>