实现排序

This commit is contained in:
2022-02-05 16:08:54 +08:00
parent 42bb51bf4e
commit ff8037baaf
5 changed files with 58 additions and 13 deletions

View File

@@ -1,22 +1,28 @@
<template lang="pug">
.docs-item
button.editor(@click="editor()") {{ edit ? '取消编辑' : '编辑模式' }}
button.editor(@click="editor()", v-if="account.gid") {{ edit ? '取消编辑' : '编辑模式' }}
button.submit(@click="submit()", v-if="edit") 保存修改
.contenter(v-if="!edit")
h1.title {{ data.name }}
p {{ data.data }}
div(v-html="markdown(data.data)")
.contenter(v-else)
input.title(v-model="doc.name")
textarea.data(v-model="doc.data", rows="32")
</template>
<script>
import { marked } from "marked";
export default {
asyncData({ $axios, params }) {
return $axios.get(`/api/docs/${params.id}`).then((res) => {
return { data: res.data, edit: false, doc: { data: "", name: "" } };
});
},
computed: {
account() {
return this.$store.state.account;
},
},
methods: {
editor() {
if (!this.eidt) {
@@ -35,6 +41,9 @@ export default {
console.log(res.data);
});
},
markdown(data) {
return marked.parse(data);
},
},
};
</script>

4
pages/docs/index.vue Normal file
View File

@@ -0,0 +1,4 @@
<template lang="pug">
.docs-index
p Hello World!
</template>