# 实例生命周期钩子-ta3
> 代码:
~~~
<template>
<div id="appa3">
<span id = "test">test</span>
</div>
</template>
<script>
export default {
mounted : function () {
document.getElementById("test").style.display ="block";
document.getElementById("test").style.color ="red";
},
created: function () {
//document.getElementById("test").style.display ="block";
//document.getElementById("test").style.color ="blue";
}
}
</script>
~~~
> 结果如图:
![](https://box.kancloud.cn/c1d2edcd35c4a70a02cc5296eee88204_1138x502.gif)