我想知道是否有办法检查是否安装了 enitre Vue 应用程序?
我正在加载一个对话框脚本,该脚本检查页面上的某些链接并向它们添加一个对话框事件......但问题是当页面加载时它运行得太早。使用 jQuery 的 .ready() 函数。但此时尚未安装所有组件...并且某些 Vue 组件链接未附加对话框链接事件。
我希望能够做这样的事情:
$( document ).ready( function () {
const app = createApp();
app.component( 'section-header', SectionHeader );
// more components etc...
const mountedApp = app.mount( '#app' );
if (mountedApp.ready()) {
// now load my custom non-vue dialog script so we are sure the DOM AND the all components are mounted.
let CsDialog = require( './vendor/cs-dialog.min' );
dialog = new CsDialog();
dialog.bindEvents();
}
}); Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号