我在檔案中找不到這一點。只有關于在app上注冊全域的資訊
是否可以用<script setup>來注冊一個自定義范圍的指令呢?
如果我使用常規腳本,我有這樣的東西:
<script>
import { defineComponent } from 'vue'/span>
import { customDirective } from './customDirective';
export default defineComponent( {
directives: { customDirective }
})
</script>
現在用<script setup>:
<script setup>
//如何注冊這個?
import { customDirective } from './customDirective'/span>;
</script>
如果我讓它像這樣,我在控制臺中得到了錯誤
希望得到任何幫助失敗了。
決議指令失敗
你需要用v前綴來解決它。
<script setup>
import { customDirective as vCustomDirective } from './customDirective'/span>;
</script>
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/331539.html
標籤:
