我在 v-dialog box 中使用了 v-card 組件。
<v-dialog
v-model="dialog3"
transition="dialog-bottom-transition"
max-width="600"
>
<v-card>
<v-card-title >
Print Record
</v-card-title>
<v-card-text>
<v-checkbox
v-model="includeAnnotations"
label="Include Annotations"
@change="deselectDisabled()"
></v-checkbox>
<v-radio-group v-model="annotationOption">
<v-radio
:value="embedIntoImage"
label="Embedded Into Image"
:disabled="includeAnnotations === false"
></v-radio>
<v-radio
:value="burnIntoImage"
label="Burn Into Image"
:disabled="includeAnnotations === false"
></v-radio>
<v-checkbox
v-model="maintainColor"
label="Maintain Annotation Color "
:disabled="
annotationOption === 0 || includeAnnotations === false
"
></v-checkbox>
</v-radio-group>
<v-checkbox
v-model="burnReduction"
label="Burn Reduction"
></v-checkbox>
</v-card-text>
<v-divider></v-divider>
<!-- -->
<v-card-actions>
<v-spacer></v-spacer>
<v-btn @click="onDownloadFile()">
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
v-card 組件正在許多其他地方使用,具有完全相同的引數、值等。我想讓它可重用,這樣我就可以在一個地方定義它并呼叫它。需要幫忙
uj5u.com熱心網友回復:
使用您的 v-card 創建一個組件并全域注冊它:
Vue.component('mycard', require('./components/my-card-component.vue').default);
然后你可以在任何你想要的地方使用它:
<v-dialog
v-model="dialog3"
transition="dialog-bottom-transition"
max-width="600"
>
<mycard></mycard>
</v-dialog>
見官方檔案:https : //vuejs.org/v2/guide/components-registration.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/402897.html
標籤:
