[英]When should I put my code outside the export module, lifecycle hooks in a single file Vue component?
我正在編寫一個代碼,該代碼需要計算一些邏輯,例如處理一些數組。
因此,通常,單個文件Vue組件如下所示:
<template>
...
</template>
<script>
import ...
// When should I put my code here?
export default {
created: function() {
// And what type of code I should put here?
}
}
</script>
我應該在什么時候import
和export
什么類型的代碼?
謝謝!
也許您可以在那里定義一些常數。 像這樣:
const THIS_IS_A_CONSTANT = 'thisIsAConstant'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.