<div >
        <h3>{{reverseMsg}}</h3>
    </div>

    <script>
        new Vue({
            el: '#app',
            data: {
                msg: 'hello world'
            },
            computed: {
                //computed默认只有getter方法
                //计算属性最大的优点:产生缓存,如果数据没有发生变化,直接从缓存中去取
                reverseMsg: function() {
                    return this.msg.split('').reverse().join('')
                }
            },
        })
    </script>

 

相关文章:

  • 2021-08-17
  • 2021-07-28
  • 2021-11-28
  • 2021-05-22
  • 2022-01-26
  • 2022-12-23
猜你喜欢
  • 2021-04-19
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2021-12-26
  • 2021-11-06
  • 2021-09-13
相关资源
相似解决方案