Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine if vue.js is used in a site or web app?

Tags:

vue.js

vuejs2

Is there a command in console? Or a tell tale sign like ng directives used in angular for vue that let you know if it's used in a site or app?

like image 934
Callat Avatar asked Jan 31 '18 16:01

Callat


People also ask

What VueJS is used for?

Vue. js (or simply Vue) is a lightweight, JavaScript framework for building reactive web user interfaces. Vue extends standard HTML and CSS to create a suite of powerful tools for building the front end of interactive web applications.

Is Vue used for single-page app?

Vue. js has become one of the leading frameworks for building single-page applications.


1 Answers

The Vue dev tools uses three different approaches.

One of the approaches is this:

// Method 3: Scan all elements inside document
const all = document.querySelectorAll('*')
let el
for (let i = 0; i < all.length; i++) {
  if (all[i].__vue__) {
    el = all[i]
    break
  }
}
if (el) {
  let Vue = Object.getPrototypeOf(el.__vue__).constructor
  while (Vue.super) {
    Vue = Vue.super
  }
  win.postMessage({
    devtoolsEnabled: Vue.config.devtools,
    vueDetected: true,
  }, '*')
  return
}
like image 113
ceejayoz Avatar answered Oct 01 '22 21:10

ceejayoz