Advertisement
Guest User

Untitled

a guest
Dec 14th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <template>
  2.   <div id="wrapper">
  3.     <main>
  4.       <router-link to="/heim">Heim</router-link>
  5.  
  6.       <div id="calcUt">
  7.         <div id="skjerm">
  8.           {{ tall1 }} {{pluss}}  {{tall2}} = {{svar}}
  9.         </div>
  10.         <button v-on:click="leggTil" class="xKnapp" type="button">+</button>
  11.         <button v-on:click="summer" class="xKnapp" type="button">=</button>
  12.         <button v-on:click="cls" class="xKnapp" type="button">CLEAR</button>
  13.         <div>
  14.           <ul v-for="i in 9" id="grid">
  15.             <button v-on:click="skiftTall(i)" class="knappar" type="button">{{i}}</button>
  16.           </ul>
  17.         </div>
  18.       </div>
  19.  
  20.     </main>
  21.   </div>
  22. </template>
  23.  
  24. <script>
  25. export default {
  26.   name: 'calc-page',
  27.   components: {},
  28.   methods: {
  29.     skiftTall: function (e) {
  30.       if (this.pluss !== '') {
  31.         this.tall2 += e
  32.       } else {
  33.         this.tall1 += e
  34.       }
  35.     },
  36.     leggTil: function () {
  37.       this.pluss = '+'
  38.     },
  39.     summer: function () {
  40.       this.svar = parseInt(this.tall1) + parseInt(this.tall2)
  41.     },
  42.     cls: function () {
  43.       this.tall1 = ''
  44.       this.tall2 = ''
  45.       this.svar = ''
  46.       this.pluss = ''
  47.     }
  48.   },
  49.   data () {
  50.     return {
  51.       tall1: '',
  52.       tall2: '',
  53.       svar: '',
  54.       pluss: ''
  55.     }
  56.   }
  57. }
  58. </script>
  59.  
  60. <style lang="css">
  61. div {
  62. }
  63. .xKnapp {
  64.   width: auto;
  65.   height: 10%;
  66. }
  67. #grid {
  68.   display: grid;
  69.   grid-template-columns: repeat(3, 1fr);
  70.   grid-auto-rows: 50px;
  71.   grid-gap: 2em;
  72. }
  73.  
  74. #skjerm {
  75.   border-style: solid;
  76. }
  77.  
  78. #wrapper {
  79.   background:
  80.     radial-gradient(
  81.       ellipse at top left,
  82.       rgba(255, 255, 255, 1) 0%,
  83.       rgba(229, 229, 229, .9) 20%
  84.     );
  85.   height: 800px;
  86.   width: 100%;
  87. }
  88. button {
  89. }
  90.  
  91. main {
  92. }
  93.  
  94. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement