diff --git a/01-basics/10-create-app/script.js b/01-basics/10-create-app/script.js index 5c9e337..bff75e3 100644 --- a/01-basics/10-create-app/script.js +++ b/01-basics/10-create-app/script.js @@ -1 +1,18 @@ import { defineComponent, createApp } from 'vue/dist/vue.esm-bundler.js' + +const App = defineComponent({ + name: 'App', + + setup() { + return { + } + }, + + template: ` +
Сегодня ${ new Date().toLocaleDateString(navigator.language, { dateStyle: 'long' }) }
+ `, +}) + +const app = createApp(App) + +app.mount('#app') diff --git a/01-basics/20-weather/WeatherApp.js b/01-basics/20-weather/WeatherApp.js index 851e1e2..00c3c8e 100644 --- a/01-basics/20-weather/WeatherApp.js +++ b/01-basics/20-weather/WeatherApp.js @@ -4,44 +4,68 @@ import { getWeatherData, WeatherConditionIcons } from './weather.service.ts' export default defineComponent({ name: 'WeatherApp', + setup() { + function convertNumber(value) { + return value.toFixed(1); + } + + function convertMmHg(value) { + return (value * 0.75).toFixed(0); + } + + function timeComparison(currentTime, sunriseTime, sunsetTime) { + return currentTime < sunriseTime || currentTime > sunsetTime; + } + + return { + convertNumber, + convertMmHg, + timeComparison, + getWeatherData, + WeatherConditionIcons, + } + }, + template: `

Погода в Средиземье

-