Просмотр исходного кода

Add the runtime-only warning for el in-DOM HTML template (#5039)

* Runtime-only warning for el on-site template

* Add el check in mountComponent before warning
Changyu Geng 9 лет назад
Родитель
Сommit
7de165c99e
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      src/core/instance/lifecycle.js

+ 3 - 2
src/core/instance/lifecycle.js

@@ -141,10 +141,11 @@ export function mountComponent (
     vm.$options.render = createEmptyVNode
     if (process.env.NODE_ENV !== 'production') {
       /* istanbul ignore if */
-      if (vm.$options.template && vm.$options.template.charAt(0) !== '#') {
+      if ((vm.$options.template && vm.$options.template.charAt(0) !== '#') ||
+        vm.$options.el || el) {
         warn(
           'You are using the runtime-only build of Vue where the template ' +
-          'option is not available. Either pre-compile the templates into ' +
+          'compiler is not available. Either pre-compile the templates into ' +
           'render functions, or use the compiler-included build.',
           vm
         )