Reputation: 281
I write a function in A.js file, but i want to use it to handle string in template of B.vue, but i get the error TypeError: _vm.translatecomponent is not a function, i am new to vue, could you tell me what's wrong?
A.js
export function traslate(originalValue){
return originalValue
}
B.vue
.......
<el-button type="primary">{{translatecomponent(searchFunc.queryText)}}</el-button>
</template>
<script>
import { translatecomponent } from '@/directive/index' //this is file path
Thanks in advance
Upvotes: 0
Views: 31
Reputation: 191
It must be declared in methods.
B.vue
<script>
import { translatecomponent } from '@/directive/index' //this is file path
export default {
...
methods:{ translatecomponent }
}
</script>
Upvotes: 1