ctxcode/vue-pre

this. not working inside javascript expressions

Opened this issue · 0 comments

In vue you can do:

<h1>{{ this.shared.merchant_type == 'small' ? tli(6617, 'Get more customers!', 'Title on the merchant page landing page for small companies') : tli(6618, 'Get more customers!', 'Title on the merchant page landing page for big companies') }}</h1>

This does work in vue, but not in vue pre since it won't recognise the variable this and evaluate to undefined, always returning false.

This fix is this, but this is a hidden bug that can cause unexpected behaviour. So it's better to get this fixed or throw a warning/error.
<h1>{{ shared.merchant_type == 'small' ? tli(6617, 'Get more customers!', 'Title on the merchant page landing page for small companies') : tli(6618, 'Get more customers!', 'Title on the merchant page landing page for big companies') }}</h1>