[英]how to use the component from other vue in template
我在A.js文件中編寫了一個函數,但是我想用它來處理B.vue模板中的字符串,但出現錯誤TypeError:_vm.translatecomponent不是函數,我是vue的新手,你能告訴我嗎我怎么了
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
提前致謝
必須在方法中聲明。
B.vue
<script>
import { translatecomponent } from '@/directive/index' //this is file path
export default {
...
methods:{ translatecomponent }
}
</script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.