Converted entity-dash from vue to a component

This commit is contained in:
Dan Brown
2020-06-28 21:15:00 +01:00
parent a5fa745749
commit 10305a4446
10 changed files with 111 additions and 90 deletions

View File

@ -1,44 +0,0 @@
let data = {
id: null,
type: '',
searching: false,
searchTerm: '',
searchResults: '',
};
let computed = {
};
let methods = {
searchBook() {
if (this.searchTerm.trim().length === 0) return;
this.searching = true;
this.searchResults = '';
let url = window.baseUrl(`/search/${this.type}/${this.id}`);
url += `?term=${encodeURIComponent(this.searchTerm)}`;
this.$http.get(url).then(resp => {
this.searchResults = resp.data;
});
},
checkSearchForm() {
this.searching = this.searchTerm > 0;
},
clearSearch() {
this.searching = false;
this.searchTerm = '';
}
};
function mounted() {
this.id = Number(this.$el.getAttribute('entity-id'));
this.type = this.$el.getAttribute('entity-type');
}
export default {
data, computed, methods, mounted
};

View File

@ -4,14 +4,12 @@ function exists(id) {
return document.getElementById(id) !== null;
}
import entityDashboard from "./entity-dashboard";
import imageManager from "./image-manager";
import tagManager from "./tag-manager";
import attachmentManager from "./attachment-manager";
import pageEditor from "./page-editor";
let vueMapping = {
'entity-dashboard': entityDashboard,
'image-manager': imageManager,
'tag-manager': tagManager,
'attachment-manager': attachmentManager,