|
|
@@ -110,7 +110,19 @@ export function createAppAPI<HostNode, HostElement>(
|
|
|
},
|
|
|
|
|
|
mixin(mixin: ComponentOptions) {
|
|
|
- context.mixins.push(mixin)
|
|
|
+ if (__DEV__ && !__FEATURE_OPTIONS__) {
|
|
|
+ warn('Mixins are only available in builds supporting Options API')
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!context.mixins.includes(mixin)) {
|
|
|
+ context.mixins.push(mixin)
|
|
|
+ } else if (__DEV__) {
|
|
|
+ warn(
|
|
|
+ 'Mixin has already been applied to target app' +
|
|
|
+ (mixin.name ? `: ${mixin.name}` : '')
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
return app
|
|
|
},
|
|
|
|
|
|
@@ -121,6 +133,11 @@ export function createAppAPI<HostNode, HostElement>(
|
|
|
if (!component) {
|
|
|
return context.components[name]
|
|
|
} else {
|
|
|
+ if (__DEV__ && context.components[name]) {
|
|
|
+ warn(
|
|
|
+ `Component "${name}" has already been registered in target app.`
|
|
|
+ )
|
|
|
+ }
|
|
|
context.components[name] = component
|
|
|
return app
|
|
|
}
|
|
|
@@ -134,6 +151,11 @@ export function createAppAPI<HostNode, HostElement>(
|
|
|
if (!directive) {
|
|
|
return context.directives[name] as any
|
|
|
} else {
|
|
|
+ if (__DEV__ && context.directives[name]) {
|
|
|
+ warn(
|
|
|
+ `Directive "${name}" has already been registered in target app.`
|
|
|
+ )
|
|
|
+ }
|
|
|
context.directives[name] = directive
|
|
|
return app
|
|
|
}
|