如何确定 vue.js 是在站点还是 Web 应用程序中使用?

Cal*_*lat 5 vue.js vuejs2

控制台中有命令吗?或者像ngangular for vue 中使用的指令这样的告示标志,让你知道它是在网站还是应用程序中使用的?

cee*_*yoz 9

Vue 开发工具似乎使用这种方法

const all = document.querySelectorAll('*')
let el
for (let i = 0; i < all.length; i++) {
  if (all[i].__vue__) {
    el = all[i]
    break
  }
}
if (el) {
  // Vue exists!
} else {
  // Vue does not exist :-(
}
Run Code Online (Sandbox Code Playgroud)