W
W
WebDev2018-06-07 17:34:07
Vue.js
WebDev, 2018-06-07 17:34:07

Error while importing method?

<h1>{{ trans('page') }}</h1>

...

<script>
import {trans} from '@/functions'
...
</script>

I get the error Property or method "trans" is not defined on the instance but referenced during render
How do I use an imported method directly in the markup?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-06-07
@kirill-93

Clearly it is written - the method is not defined. Add it to the methods of the component:

methods: {
  trans
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question