ページのソースを見れるように

This commit is contained in:
syuilo
2019-05-01 20:48:56 +09:00
parent 76c538ad25
commit 79c49bc926
7 changed files with 113 additions and 27 deletions

View File

@@ -1,7 +1,7 @@
<template>
<mk-ui>
<main>
<x-page-editor :page="page"/>
<x-page-editor v-if="page !== undefined" :page="page" :readonly="readonly"/>
</main>
</mk-ui>
</template>
@@ -15,9 +15,44 @@ export default Vue.extend({
},
props: {
page: {
pageId: {
type: String,
required: false
},
pageName: {
type: String,
required: false
},
user: {
type: String,
required: false
}
},
data() {
return {
page: undefined,
readonly: false
};
},
created() {
if (this.pageId) {
this.$root.api('pages/show', {
pageId: this.pageId,
}).then(page => {
this.page = page;
});
} else if (this.pageName && this.user) {
this.$root.api('pages/show', {
name: this.pageName,
username: this.user,
}).then(page => {
this.readonly = true;
this.page = page;
});
} else {
this.page = null;
}
}
});