增加模板测试用例用法
This commit is contained in:
@@ -0,0 +1,15 @@
|
|||||||
|
Vue.component('my-component', {
|
||||||
|
template: `
|
||||||
|
<div class="head">
|
||||||
|
<h1 @click="show">ddd{{message}}</h1>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
data: function(){
|
||||||
|
return {message: 'helloa'}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
show() {
|
||||||
|
alert();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="example">
|
||||||
|
<my-component></my-component>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript" src="../../js/vue.js" ></script>
|
||||||
|
<script type="text/javascript" src="component.js" ></script>
|
||||||
|
<script>
|
||||||
|
// 创建根实例
|
||||||
|
new Vue({
|
||||||
|
el: '#example'
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user