How can I bind the html <title> content in vuejs?

后端 未结 5 484
后悔当初
后悔当初 2020-11-29 00:19

I\'m trying a demo on vuejs. Now I want the html title to bind a vm field.

The below is what I tried:

index.html



        
5条回答
  •  离开以前
    2020-11-29 00:49

    There are essentially two ways to solve it.

    Use an existing Package

    For example, vue-meta:

    
    
    
    
    
    

    Create your own Component

    Create a vue file containing:

    
    

    Register the component using

    import titleComponent from './title.component.vue';
    Vue.component('vue-title', titleComponent);
    

    Then you can use it in your views, e.g.

    
    
    

提交回复
热议问题