Не отображаются встроенные директивы Vue "v-"
Подскажите пожалуйста, в чем может быть проблема. Подключил библиотеку Vue, но не могу прописать встроенные директивы "v-", они просто не отображаются в качестве встроенных
Грубо говоря
<div class='root'>
{{message}}
<input type='text' v-model='message'/>
</div>
директива "v-model" никак не обрабатывается
UPD. Проблема была в очередности подключения библиотек. Суть в том, что на момент выполнения скрипта библиотеки не подключались. Проблема решена
Ответы (1 шт):
Автор решения: Андрей Осьмаков
→ Ссылка
О какой обработке вы спрашиваете? Посмотрите для вас создал пример
const App = {
data: () => ({
title: 'Основы Vue 3',
placeholder: 'введите текст',
inputValue: ''
}),
watch: {
inputValue(value) {
this.inputValue = value
}
}
}
Vue.createApp(App).mount('#app')
* {
box-sizing: border-box;
}
body,
html {
background: #1e2021;
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
main {
width: 100%;
height: 100%;
position: relative;
padding-top: 30px;
background-image:
linear-gradient(rgba(30, 32, 33, 0.2),
rgb(30, 42, 53)),
url("https://images.unsplash.com/photo-1552910996-e666ad64695c?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80");
background-size: cover;
background-position: bottom center;
}
#app {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
body {
font-family: Inter, Roboto, Oxygen, Fira Sans, Helvetica Neue, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 16px;
color: white;
}
.root {
margin: 0 auto;
max-width: 700px;
overflow: hidden;
padding: 1rem;
margin-bottom: 1rem;
border-radius: 10px;
box-shadow: 2px 3px 10px rgba(0, 0, 0, 1);
}
hr {
margin: 1rem 0;
}
h1 {
font-weight: 500;
line-height: 1.45;
font-size: 2.2rem;
font-weight: 600;
}
.form-control {
margin-bottom: 0.5rem;
}
.form-control input {
margin: 0;
outline: none;
border: 2px solid #ccc;
width: 100%;
color: black;
padding: 0.5rem 1.5rem;
border-radius: 3px;
font-size: 1rem;
}
<!doctype html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Основы Vue </title>
<style>
[v-cloak] {
display: none;
}
</style>
</head>
<body>
<script src="https://unpkg.com/vue@next"></script>
<main id="app">
<div class="root" v-cloak>
<h1 style="text-align: center"
v-text="title">
</h1>
<div class="form-control">
<input type="text"
v-model="inputValue"
:placeholder = placeholder
/>
</div>
<div>
Вы ввели: {{ inputValue }}
</div>
</div>
</main>
</body>
</html>