You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

34 lines
721 B

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>el与data的两种写法</title>
<script type="text/javascript" src="../vue.js"></script>
</head>
<body>
<div id="root">
<h1>你好, {{name}}</h1>
</div>
<script type="text/javascript">
Vue.config.productionTip = false
const v = new Vue({
el: '#root',
// data的函数式写法
// data: {
// name: 'Roger'
// }
// data的函数式写法
data: function () {
console.log('@@@', this)
return {
name: 'Roger'
}
}
})
console.log(v)
// el的新写法
v.$mount('#root')
</script>
</body>
</html>