We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
比较简单,增加一个全局变更,增加一个static方法use。
use
主要是函数 apply用法
// 全局插件 const globalPlugins: Array<Function | Object> = [] class Xiao{ // 其他代码 /** * 插件安装指令 */ // D:\OutPut\VUE\vue\src\core\global-api\use.js static use(plugin: Function | Object) { if (globalPlugins.indexOf(plugin) > -1) { return } //fixme additional parameters const args = toArray(arguments, 1) args.unshift(Xiao) //放到第一个位置 if (typeof plugin.install === 'function') { plugin.install.apply(Xiao, args) } else if (typeof plugin === 'function') { plugin.apply(Xiao, args) } globalPlugins.push(plugin) } }
插件可以直接传入一个函数,或者一个包含 install 函数的对象。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
实现
比较简单,增加一个全局变更,增加一个static方法
use
。主要是函数 apply用法
插件可以直接传入一个函数,或者一个包含 install 函数的对象。
The text was updated successfully, but these errors were encountered: