|
|
(未显示同一用户的7个中间版本) |
第1行: |
第1行: |
| // 等待页面加载完成 | | // mw.loader.load( 'https://thga.me/用户:玲子/CodexDemo.js?action=raw&ctype=text/javascript' ); |
| mw.loader.using( '@wikimedia/codex' ).then( function( require ) { | |
| const Vue = require( 'vue' );
| |
| // 创建 Vue 应用
| |
| const app = Vue.createApp({
| |
| data() {
| |
| return {
| |
| showDialog: false
| |
| };
| |
| },
| |
| methods: {
| |
| openDialog() {
| |
| this.showDialog = true;
| |
| },
| |
| closeDialog() {
| |
| this.showDialog = false;
| |
| }
| |
| },
| |
| template: `
| |
| <div>
| |
| <cdx-button
| |
| weight="primary"
| |
| @click="openDialog"
| |
| >
| |
| 打开对话框
| |
| </cdx-button>
| |
| | |
| <cdx-dialog
| |
| v-model:open="showDialog"
| |
| title="提示"
| |
| @close="closeDialog"
| |
| >
| |
| <p>这是一个使用 Codex 和 Vue 实现的对话框示例。</p>
| |
| <template #footer>
| |
| <cdx-button
| |
| weight="primary"
| |
| @click="closeDialog"
| |
| >
| |
| 确定
| |
| </cdx-button>
| |
| </template>
| |
| </cdx-dialog>
| |
| </div>
| |
| `
| |
| });
| |
| | |
| // 创建容器元素
| |
| const container = document.createElement('div');
| |
| container.id = 'codex-demo';
| |
| document.body.appendChild(container);
| |
| | |
| // 挂载 Vue 应用
| |
| app.mount('#codex-demo');
| |
| });
| |
// mw.loader.load( 'https://thga.me/用户:玲子/CodexDemo.js?action=raw&ctype=text/javascript' );