vue(1)和js区别
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>vue</title></head><body><script type="text/javascript" src="vue.min.js"&g...
·
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vue</title>
</head>
<body>
<script type="text/javascript" src="vue.min.js"></script>
<div id="div1"></div>
<script type="text/javascript">//js方式
var gareen = {"name":"盖伦","hp":626};
var div1 = document.getElementById("div1");
div1.innerHTML = gareen.name;
</script>
<div id="div2">{{gareen.name}}</div>
<script type="text/javascript">//vue方式
var gareen = {"name":"盖伦","hp":626};
new Vue({
el:'#div2',
data:{
message:gareen,
}
});
</script>
</body>
</html>
更多推荐
已为社区贡献1条内容
所有评论(0)