calculator
This commit is contained in:
parent
5cc5a74cb9
commit
659777af3b
@ -11,8 +11,14 @@
|
||||
|
||||
<body>
|
||||
<div id="app">
|
||||
{{ message }}
|
||||
<button @click="changeMessage">Change the message!</button>
|
||||
<p>
|
||||
{{ message }}
|
||||
|
||||
<button @click="changeMessage">Change the message!</button>
|
||||
</p>
|
||||
|
||||
<!-- Vypíše počet sudých čísel v numbers -->
|
||||
{{ evenNumbersCount }}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
@ -20,12 +26,20 @@
|
||||
el: "#app",
|
||||
data: {
|
||||
message: "Hello Vue!",
|
||||
numbers: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
|
||||
},
|
||||
|
||||
methods: {
|
||||
changeMessage() {
|
||||
this.message = "Hello World!";
|
||||
},
|
||||
},
|
||||
|
||||
computed: {
|
||||
evenNumbersCount() {
|
||||
return this.numbers.filter((i) => i % 2 === 0).length;
|
||||
},
|
||||
},
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
4
itn/calculator/.browserslistrc
Normal file
4
itn/calculator/.browserslistrc
Normal file
@ -0,0 +1,4 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
||||
not ie 11
|
17
itn/calculator/.eslintrc.js
Normal file
17
itn/calculator/.eslintrc.js
Normal file
@ -0,0 +1,17 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
'extends': [
|
||||
'plugin:vue/vue3-essential',
|
||||
'eslint:recommended'
|
||||
],
|
||||
parserOptions: {
|
||||
parser: '@babel/eslint-parser'
|
||||
},
|
||||
rules: {
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
|
||||
}
|
||||
}
|
23
itn/calculator/.gitignore
vendored
Normal file
23
itn/calculator/.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
24
itn/calculator/README.md
Normal file
24
itn/calculator/README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# calculator
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
5
itn/calculator/babel.config.js
Normal file
5
itn/calculator/babel.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
19
itn/calculator/jsconfig.json
Normal file
19
itn/calculator/jsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
11795
itn/calculator/package-lock.json
generated
Normal file
11795
itn/calculator/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
itn/calculator/package.json
Normal file
23
itn/calculator/package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "calculator",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.8.3",
|
||||
"vue": "^3.2.13"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3"
|
||||
}
|
||||
}
|
BIN
itn/calculator/public/favicon.ico
Normal file
BIN
itn/calculator/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
17
itn/calculator/public/index.html
Normal file
17
itn/calculator/public/index.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
28
itn/calculator/src/App.vue
Normal file
28
itn/calculator/src/App.vue
Normal file
@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<the-layout />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TheLayout from "@/components/TheLayout.vue";
|
||||
export default {
|
||||
name: "App",
|
||||
components: { TheLayout },
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
</style>
|
36
itn/calculator/src/components/CalculatorButton.vue
Normal file
36
itn/calculator/src/components/CalculatorButton.vue
Normal file
@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<div class="calculator-button">{{ displayValue }}</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
name: "CalculatorButton",
|
||||
props: {
|
||||
displayValue: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.calculator-button {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
padding: 0.75em;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
flex: 0 0 auto;
|
||||
width: 60px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
.calculator-button:active {
|
||||
transform: scale(0.85);
|
||||
box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
.calculator-button:hover {
|
||||
background: #f2edcf;
|
||||
}
|
||||
</style>
|
62
itn/calculator/src/components/TheLayout.vue
Normal file
62
itn/calculator/src/components/TheLayout.vue
Normal file
@ -0,0 +1,62 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="calculator">
|
||||
<div class="calculator-row">
|
||||
<div class="display">{{ value }}</div>
|
||||
<calculator-button display-value="F" />
|
||||
</div>
|
||||
<div class="calculator-row" />
|
||||
<div class="calculator-row" />
|
||||
<div class="calculator-row" />
|
||||
<div class="calculator-row" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import CalculatorButton from "./CalculatorButton.vue";
|
||||
export default {
|
||||
components: { CalculatorButton },
|
||||
name: "TheLayout",
|
||||
data() {
|
||||
return {
|
||||
value: "0",
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
background: #efefef;
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.calculator {
|
||||
background: #f6f3df;
|
||||
border: 1px solid #bcbcbc;
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.calculator-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
height: 60px;
|
||||
width: 240px;
|
||||
}
|
||||
.calculator-row:first-child {
|
||||
border-bottom: 1px solid #cdcdcd;
|
||||
}
|
||||
.display {
|
||||
flex: 1;
|
||||
font-size: 1.5rem;
|
||||
padding: 0.5em;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background: #def7eb;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
5
itn/calculator/src/main.js
Normal file
5
itn/calculator/src/main.js
Normal file
@ -0,0 +1,5 @@
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import CalculatorButton from "@/components/CalculatorButton.vue";
|
||||
|
||||
createApp(App).component("CalculatorButton", CalculatorButton).mount("#app");
|
4
itn/calculator/vue.config.js
Normal file
4
itn/calculator/vue.config.js
Normal file
@ -0,0 +1,4 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true
|
||||
})
|
@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<header></header>
|
||||
<main></main>
|
||||
<footer></footer>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user