vue组件自定义属性props

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>vue组件自定义属性props</title>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
</head>

<body>
<div id="app">
<assembly message="前端菜鸟组件!"></assembly>
</div>

<script type="text/javascript">
Vue.component("assembly",{
props:["message"],
template:"<div>{{message}}</div>"
})
new Vue({
el:"#app"
})

</script>
</body>
</html>

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: