From b45cc5a409ffc881cba61c798fcf5990f99bdaf6 Mon Sep 17 00:00:00 2001 From: alexmenshikov Date: Mon, 15 Jul 2024 21:50:21 +0700 Subject: [PATCH] =?UTF-8?q?createApp=20=D0=B8=20=D1=88=D0=B0=D0=B1=D0=BB?= =?UTF-8?q?=D0=BE=D0=BD=20=D0=BF=D0=BE=D0=B3=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 01-basics/10-create-app/script.js | 17 +++++++++++ 01-basics/20-weather/WeatherApp.js | 48 ++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 12 deletions(-) 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: `

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

-