debian-mirror-gitlab/app/assets/javascripts/issuable_suggestions/index.js

39 lines
861 B
JavaScript
Raw Normal View History

2019-02-15 15:39:39 +05:30
import Vue from 'vue';
import VueApollo from 'vue-apollo';
2019-07-07 11:18:12 +05:30
import createDefaultClient from '~/lib/graphql';
2019-02-15 15:39:39 +05:30
import App from './components/app.vue';
Vue.use(VueApollo);
2021-03-11 19:13:27 +05:30
export default function initIssuableSuggestions() {
2019-02-15 15:39:39 +05:30
const el = document.getElementById('js-suggestions');
const issueTitle = document.getElementById('issue_title');
const { projectPath } = el.dataset;
const apolloProvider = new VueApollo({
2019-07-07 11:18:12 +05:30
defaultClient: createDefaultClient(),
2019-02-15 15:39:39 +05:30
});
return new Vue({
el,
apolloProvider,
data() {
return {
search: issueTitle.value,
};
},
mounted() {
issueTitle.addEventListener('input', () => {
this.search = issueTitle.value;
});
},
render(h) {
return h(App, {
props: {
projectPath,
search: this.search,
},
});
},
});
}