Vue.js是一套构建用户界面的渐进式框架。与其他重量级框架不同的是,Vue 采用自底向上增量开发的设计。Vue 的核心库只关注视图层,不仅易于上手,还便于与第三方库或既有项目整合
框架和库的区别
框架:是一套完整的解决方案;对项目的侵入性较大,项目如果需要更换框架,则需要重新架构整个项目
MVC与MVVM的区别
MVC 是后端的分层开发概念;
MVVM是前端视图层的概念,主要关注于视图层分离,也就是说:MVVM把前端的视图层,分为了三部分Model、View、VM ViewModel;
<!DOCTYPE html>
<html lang="en">
<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">
<title>Document</title>
<script src="./vue-2.4.0.js"></script>
</head>
<body>
<div id="app">
<button @click="start" :disabled="dsad">浪起来</button>
<button @click="end" :disabled="!dsad">稳住</button>
<div> {
{num
}}</div>
</div>
</body>
<script>
let vm = new Vue({
el: '#app',
data: {
num: '猥琐发育别浪!',
dsad: false,
timer: null,
},
methods: {
start() {
this.dsad = true
this.timer = setInterval(() => {
let one = this.num[0]
let two = this.num.substring(1)
this.num = two + one
}, 500)
},
end() {
this.dsad = false
clearInterval(this.timer)
}
}
})
</script>
</html>