Заавар
Үндсэн ойлголт
- Суулгах заавар
- Танилцуулга
- Vue-ийн Instance үүсгэх
- Template Syntax
- Computed Properties and Watchers
- Class болон Style Bindings
- Conditional Rendering
- Жагсаалт рэндэрлэх
- Event Handling
- Form Input холболтууд
- Component-уудын үндэс
Components In-Depth
- Component Registration
- Props
- Custom Events
- Slots гэж юу вэ
- Динамик & Асинхрон компонентууд
- Handling Edge Cases
Транситион & Анимэйшн
- Enter/Leave & List Transitions
- State Transitions
Дахин ашиглагдах & Зохиомж
- Mixins
- Custom Directives
- Рэндэр функцууд & JSX
- Нэмэлтүүд
- Filter-үүд
Багаж хэрэгсэл
- Single File Components
- Unit тэст
- TypeScript дэмжлэг
- Production Deployment
Өргөтгөх
- Routing - Чиглүүлэлт
- State Management
- Server-Side Rendering
- Security
Шинж чанар
- Reactivity in Depth
Шинэ хувилбарлуу шилжих
- Vue 1.x ээс шилжих
- Vue Router 0.7.x оос шилжих
- Vuex 0.6.x аас 1.0 руу шилжих
Мета
- Бусад фрэймворктой харьцуулбал
- Vue.js Community-д нэгдэх!
- Багийн гишүүдийн танилцуулга
State Transitions
Vue’s transition system offers many simple ways to animate entering, leaving, and lists, but what about animating your data itself? For example:
- numbers and calculations
- colors displayed
- the positions of SVG nodes
- the sizes and other properties of elements
All of these are either already stored as raw numbers or can be converted into numbers. Once we do that, we can animate these state changes using 3rd-party libraries to tween state, in combination with Vue’s reactivity and component systems.
Animating State with Watchers
Watchers allow us to animate changes of any numerical property into another property. That may sound complicated in the abstract, so let’s dive into an example using GreenSock:
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.20.3/TweenMax.min.js"></script>
<div id="animated-number-demo">
<input v-model.number="number" type="number" step="20">
<p>{{ animatedNumber }}</p>
</div>
new Vue({
el: '#animated-number-demo',
data: {
number: 0,
tweenedNumber: 0
},
computed: {
animatedNumber: function() {
return this.tweenedNumber.toFixed(0);
}
},
watch: {
number: function(newValue) {
TweenLite.to(this.$data, 0.5, { tweenedNumber: newValue });
}
}
})