vue/10-组件化开发/06-实现组件的动态数据/组件动态数据.html

42 lines
985 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>
</head>
<body>
<!--
注意点:
1、注意使用标签
2、注意使用组件时不能使用Vue实例对象的数据
必须在组件内建立一个data方法返回一个键值对内容
3、组件使用动态数据必须要有插值语法
-->
<div id="app">
<apps></apps>
</div>
<template id="tpl">
<div>
<h1>这是组件的水(静态)标签</h1>
<h1>{{content}}</h1>
</div>
</template>
</body>
<script src="../../JavaScript/vue.js"></script>
<script>
Vue.component(
'apps',{
template:"#tpl",
data(){
return {content:"这是组件的真实(动态)标签"}
}
})
// 这是一个Vue实例对象
const vue=new Vue({
el:"#app"
})
</script>
</html>