Panel | |
---|---|
On this page:
Target audience: Users of the extension providing Vue.js support for Web applications. |
Info |
---|
Summary: This document provides basic information about the extension providing Vue.js support for Web applications. |
...
com.castsoftware.vuejs
What's new?
Please see Vue.js - 1.2 - Release Notes for more information.
Description
...
If your Web application contains Vue.js source code used inside JavaScript files and you want to view these object types and their links with other objects, then you should install this extension.
Info |
---|
This extension does note analyse any Vue.js source code within TypeScript files. |
Supported Vue.js versions
Version | Support | Comment |
---|---|---|
v2.x |
Supported template definitions
...
Info |
---|
Unsupported template definition methods will not create links to any called functions. |
...
CAST AIP Core release | Supported |
---|---|
8.3.x |
Prerequisites
...
- HTML5/JavaScript
- Web services linker service (internal technical extension)
...
Download and installation instructions
...
What results can you expect?
Once the analysis /snapshot generation has completed, you can view the results in the normal manner (for example via CAST Enlighten):
Objects
The following specific objects are displayed in CAST Enlighten:
Icon | Description |
---|---|
Vue.js Get Request Service | |
Vue.js Post Request Service | |
Vue.js Put Request Service | |
Vue.js Delete Request Service |
Specific support
Store
The "Vuex.Store()" calls are searched for throughout the application, and the first parameter is used to resolve different links.
Code Block |
---|
Dispatch
Vue.js extension support Vuex store dispatch methods are used to call shared function.
const store = new Vuex.Store({
state: {
pageTitle: 'Home',
menu: menu,
user: {},
token: null,
message: {
type: null,
body: null
},
config: config
},
mutations: {
setAuth (state, { user, token }) {
state.user = user
state.token = token
global.helper.ls.set('user', user)
global.helper.ls.set('token', token)
},
setMenu (state, data) {
state.menu = data
},
setPageTitle (state, data) {
state.pageTitle = data
},
showMessage (state, type, body) {
state.message = { type, body }
}
},
actions: {
checkAuth ({ commit }) {
let data = {
user: global.helper.ls.get('user'),
token: global.helper.ls.get('token')
}
commit('setAuth', data)
},
checkPageTitle ({commit, state}, path) {
for (let k in state.menu) {
if (state.menu[k].href === path) {
commit('setPageTitle', state.menu[k].title)
break
}
}
}
}
})
export default store |
the "sync()" calls are also used:
Code Block |
---|
import store from './store'
import router from './router'
sync(store, router) |
Dispatch
This extension supports "Vuex store dispatch" methods which are used to call shared functions. Here is an example of a classical classic architecture using this method.:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
export const FETCH_DATA = "fetchData"; |
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<template> <div></div> </template> <script> import { FETCH_DATA } from "@/store/actions.type"; export default { name: "StoreExample", mounted: function() { this.$store.dispatch(FETCH_DATA) } }; </script> |
In EnlightenThis code gives the following results:
Webservices
Axios
The Vue.js extension supports webservices using Axios:
Code Block | ||||
---|---|---|---|---|
| ||||
async onLogout() { await this.$axios.$post('/api/oauth/logout'); this.setLogout(true); this.setCurrentUser(null); try { await this.$axios.$get('/api/oauth/me') } catch (e) { // middleware redirects to login page } } |
Giving the following graph in Enlightenresult:
Vue-resources
The Vue.js extension supports webservices using vue-resources.
Code Block | ||||
---|---|---|---|---|
| ||||
async onLogout() { await this.$http.post('/api/oauth/logout'); this.setLogout(true); this.setCurrentUser(null); try { await this.$http.$get('/api/oauth/me') } catch (e) { // middleware redirects to login page } } |
Giving the following graph in Enlightenresult:
Fetch
The Vue.js extension supports webservices using fetch:
Code Block | ||||
---|---|---|---|---|
| ||||
async onLogout() { await fetch('/api/oauth/logout'); this.setLogout(true); this.setCurrentUser(null); try { await fetch('/api/oauth/me') } catch (e) { // middleware redirects to login page } } |
Giving the following graph in Enlightenresult:
Link transition
Sometimes calls to services are factorized into a function that only concatenates URI parts leading to the following kinds of bottleneck and making it hard to follow which function called a given service:
Click to enlarge
Link transition allows the extension to go through the specified functions to make a direct link between the function defining the service URI and the service object. This leads to a better graph without bottlenecks:
Click to enlarge
Quality rules
The following structural rules are provided:
Known limitations
Store map function
Currently there are no links to the following store map functions from components using them:
- mapGetters
- mapActions
For example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
// ...
<ToggleSwitch v-model="user.autosave_notes" @change="setAutosaveNotes(user.autosave_notes)" />
// ...
methods: {
...mapActions(['deleteUser', 'setShowLanguageTags', 'setAutosaveNotes', 'revokeUserAccess']),
// ...
} |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
const actions = {
// ...
setAutosaveNotes({ commit }, flag) {
return client.put('/user/autosave-notes', { flag }).then(({ data }) => {
commit(SET_USER, data)
})
}
} |
No link shown in CAST Enlighten:
...
1.2.1-funcrel | https://technologies.castsoftware.com/rules?sec=srs_vuejs&ref=||1.2.1-funcrel |
---|---|
1.2.0-funcrel | https://technologies.castsoftware.com/rules?sec=srs_vuejs&ref=||1.2.0-funcrel |
Known limitations
Functions passed as properties
In Vue.js, components can have properties, which could be functions. Links to those functions are currently unsupported.