How to hide vue js code when reload page?

2019-05-30 08:39发布

问题:

I have a webpage application coded with Vue when reload page the code of Vue in the HTML load with code view and hide.

I need to hide this code when reload page

<script src="cdn.jsdelivr.net/npm/vue"></script> <script src="cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> <script src="./js/vue.js"></script> 

回答1:

Take a look at v-cloak, it is a directive to prevent this behavior.

In your css file you add this:

[v-cloak] {
  display: none;
}

And for the text you add the v-cloak attribute

<div v-cloak>
  {{ message }}
</div>