🎨 improve format

This commit is contained in:
yanyongyu
2021-04-05 16:35:29 +08:00
parent 176dbd5830
commit 207750774d
9 changed files with 131 additions and 115 deletions

View File

@ -82,8 +82,8 @@
color="blue darken-1"
text
@click="
dialog = false
publishAdapter()
dialog = false;
publishAdapter();
"
>
发布
@ -93,14 +93,16 @@
</v-dialog>
</v-col>
</v-row>
<v-col cols="12">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination
></v-col>
<v-row>
<v-col cols="12">
<v-pagination
v-model="page"
:length="pageNum"
prev-icon="fa-caret-left"
next-icon="fa-caret-right"
></v-pagination
></v-col>
</v-row>
<v-row>
<v-col
cols="12"
@ -129,18 +131,18 @@
</template>
<script>
import PublishCard from './PublishCard.vue'
import adapters from '../public/adapters.json'
import PublishCard from "./PublishCard.vue";
import adapters from "../public/adapters.json";
export default {
name: 'Adapters',
name: "Adapters",
components: {
PublishCard,
},
data() {
return {
adapters: adapters,
filterText: '',
filterText: "",
page: 1,
dialog: false,
valid: false,
@ -151,32 +153,32 @@ export default {
link: null,
repo: null,
},
}
};
},
computed: {
pageNum() {
return Math.ceil(this.filteredAdapters.length / 10)
return Math.ceil(this.filteredAdapters.length / 10);
},
filteredAdapters() {
return this.adapters.filter((adapter) => {
return (
adapter.id.indexOf(this.filterText || '') != -1 ||
adapter.name.indexOf(this.filterText || '') != -1 ||
adapter.desc.indexOf(this.filterText || '') != -1 ||
adapter.author.indexOf(this.filterText || '') != -1
)
})
adapter.id.indexOf(this.filterText || "") != -1 ||
adapter.name.indexOf(this.filterText || "") != -1 ||
adapter.desc.indexOf(this.filterText || "") != -1 ||
adapter.author.indexOf(this.filterText || "") != -1
);
});
},
displayAdapters() {
return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10)
return this.filteredAdapters.slice((this.page - 1) * 10, this.page * 10);
},
publishPlugin() {
if (!this.$refs.newAdapterForm.validate()) {
return
return;
}
const title = encodeURIComponent(
`Adapter: ${this.newAdapter.name}`
).replace(/%2B/gi, '+')
).replace(/%2B/gi, "+");
const body = encodeURIComponent(
`
**协议名称:**
@ -208,11 +210,11 @@ ${this.newAdapter.repo}
- repo: ${this.newAdapter.repo}
-->
`.trim()
).replace(/%2B/gi, '+')
).replace(/%2B/gi, "+");
window.open(
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Adapter`
)
);
},
},
}
};
</script>