Commit e953932d authored by Phil Hughes's avatar Phil Hughes

Merge branch 'issue-title-vue-sfc' into 'master'

Issue Title Vue: convert to .vue - use 'render' with 'createElement' in index

See merge request !10625
parents 309bab43 8918433a
import Vue from 'vue'; import Vue from 'vue';
import IssueTitle from './issue_title'; import IssueTitle from './issue_title.vue';
import '../vue_shared/vue_resource_interceptor'; import '../vue_shared/vue_resource_interceptor';
const vueOptions = () => ({ (() => {
el: '.issue-title-entrypoint',
components: {
IssueTitle,
},
data() {
const issueTitleData = document.querySelector('.issue-title-data').dataset; const issueTitleData = document.querySelector('.issue-title-data').dataset;
const { initialTitle, endpoint } = issueTitleData;
return { const vm = new Vue({
initialTitle: issueTitleData.initialTitle, el: '.issue-title-entrypoint',
endpoint: issueTitleData.endpoint, render: createElement => createElement(IssueTitle, {
}; props: {
initialTitle,
endpoint,
}, },
template: ` }),
<IssueTitle });
:initialTitle="initialTitle"
:endpoint="endpoint"
/>
`,
});
(() => new Vue(vueOptions()))(); return vm;
})();
<script>
import Visibility from 'visibilityjs'; import Visibility from 'visibilityjs';
import Poll from './../lib/utils/poll'; import Poll from './../lib/utils/poll';
import Service from './services/index'; import Service from './services/index';
...@@ -72,7 +73,9 @@ export default { ...@@ -72,7 +73,9 @@ export default {
created() { created() {
this.fetch(); this.fetch();
}, },
template: `
<h2 class='title' v-html='title'></h2>
`,
}; };
</script>
<template>
<h2 class="title" v-html="title"></h2>
</template>
...@@ -79,4 +79,5 @@ ...@@ -79,4 +79,5 @@
= render 'shared/issuable/sidebar', issuable: @issue = render 'shared/issuable/sidebar', issuable: @issue
= page_specific_javascript_bundle_tag('common_vue')
= page_specific_javascript_bundle_tag('issue_show') = page_specific_javascript_bundle_tag('issue_show')
...@@ -125,6 +125,7 @@ var config = { ...@@ -125,6 +125,7 @@ var config = {
'notebook_viewer', 'notebook_viewer',
'pdf_viewer', 'pdf_viewer',
'vue_pipelines', 'vue_pipelines',
'issue_show',
], ],
minChunks: function(module, count) { minChunks: function(module, count) {
return module.resource && (/vue_shared/).test(module.resource); return module.resource && (/vue_shared/).test(module.resource);
......
import Vue from 'vue'; import Vue from 'vue';
import issueTitle from '~/issue_show/issue_title'; import issueTitle from '~/issue_show/issue_title.vue';
describe('Issue Title', () => { describe('Issue Title', () => {
let IssueTitleComponent; let IssueTitleComponent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment