mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-24 00:55:07 +08:00
🎨 improve format
This commit is contained in:
parent
176dbd5830
commit
207750774d
9
.prettierrc
Normal file
9
.prettierrc
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"endOfLine": "lf",
|
||||
"arrowParens": "always",
|
||||
"singleQuote": false,
|
||||
"trailingComma": "es5",
|
||||
"semi": true
|
||||
}
|
@ -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>
|
||||
|
@ -68,8 +68,8 @@
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="
|
||||
dialog = false
|
||||
publishBot()
|
||||
dialog = false;
|
||||
publishBot();
|
||||
"
|
||||
>
|
||||
发布
|
||||
@ -79,14 +79,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" sm="6" v-for="(bot, index) in displayBots" :key="index">
|
||||
<PublishCard
|
||||
@ -109,18 +111,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PublishCard from './PublishCard.vue'
|
||||
import bots from '../public/bots.json'
|
||||
import PublishCard from "./PublishCard.vue";
|
||||
import bots from "../public/bots.json";
|
||||
|
||||
export default {
|
||||
name: 'Bots',
|
||||
name: "Bots",
|
||||
components: {
|
||||
PublishCard,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
bots: bots,
|
||||
filterText: '',
|
||||
filterText: "",
|
||||
page: 1,
|
||||
dialog: false,
|
||||
valid: false,
|
||||
@ -129,32 +131,32 @@ export default {
|
||||
desc: null,
|
||||
repo: null,
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
pageNum() {
|
||||
return Math.ceil(this.filteredBots.length / 10)
|
||||
return Math.ceil(this.filteredBots.length / 10);
|
||||
},
|
||||
filteredBots() {
|
||||
return this.bots.filter((bot) => {
|
||||
return (
|
||||
bot.name.indexOf(this.filterText || '') != -1 ||
|
||||
bot.desc.indexOf(this.filterText || '') != -1 ||
|
||||
bot.author.indexOf(this.filterText || '') != -1
|
||||
)
|
||||
})
|
||||
bot.name.indexOf(this.filterText || "") != -1 ||
|
||||
bot.desc.indexOf(this.filterText || "") != -1 ||
|
||||
bot.author.indexOf(this.filterText || "") != -1
|
||||
);
|
||||
});
|
||||
},
|
||||
displayBots() {
|
||||
return this.filteredBots.slice((this.page - 1) * 10, this.page * 10)
|
||||
return this.filteredBots.slice((this.page - 1) * 10, this.page * 10);
|
||||
},
|
||||
publishBot() {
|
||||
if (!this.$refs.newBotForm.validate()) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
const title = encodeURIComponent(`Bot: ${this.newBot.name}`).replace(
|
||||
/%2B/gi,
|
||||
'+'
|
||||
)
|
||||
"+"
|
||||
);
|
||||
const body = encodeURIComponent(
|
||||
`
|
||||
**机器人名称:**
|
||||
@ -176,11 +178,11 @@ ${this.newBot.repo}
|
||||
- repo: ${this.newBot.repo}
|
||||
-->
|
||||
`.trim()
|
||||
).replace(/%2B/gi, '+')
|
||||
).replace(/%2B/gi, "+");
|
||||
window.open(
|
||||
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Bot`
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -128,11 +128,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { WOW } from 'wowjs'
|
||||
import 'animate.css/animate.min.css'
|
||||
import { WOW } from "wowjs";
|
||||
import "animate.css/animate.min.css";
|
||||
|
||||
export default {
|
||||
name: 'Messenger',
|
||||
name: "Messenger",
|
||||
props: {
|
||||
messages: {
|
||||
type: Array,
|
||||
@ -140,20 +140,20 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
initWOW: function () {
|
||||
initWOW: function() {
|
||||
new WOW({
|
||||
noxClass: 'wow',
|
||||
animateClass: 'animate__animated',
|
||||
noxClass: "wow",
|
||||
animateClass: "animate__animated",
|
||||
offset: 0,
|
||||
mobile: true,
|
||||
live: true,
|
||||
}).init()
|
||||
}).init();
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initWOW()
|
||||
this.initWOW();
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@ -183,7 +183,7 @@ export default {
|
||||
background-color: #fff;
|
||||
}
|
||||
.message .message-box::after {
|
||||
content: '';
|
||||
content: "";
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
top: 0;
|
||||
|
@ -82,8 +82,8 @@
|
||||
color="blue darken-1"
|
||||
text
|
||||
@click="
|
||||
dialog = false
|
||||
publishPlugin()
|
||||
dialog = false;
|
||||
publishPlugin();
|
||||
"
|
||||
>
|
||||
发布
|
||||
@ -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"
|
||||
@ -131,18 +133,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import PublishCard from './PublishCard.vue'
|
||||
import plugins from '../public/plugins.json'
|
||||
import PublishCard from "./PublishCard.vue";
|
||||
import plugins from "../public/plugins.json";
|
||||
|
||||
export default {
|
||||
name: 'Plugins',
|
||||
name: "Plugins",
|
||||
components: {
|
||||
PublishCard,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
plugins: plugins,
|
||||
filterText: '',
|
||||
filterText: "",
|
||||
page: 1,
|
||||
dialog: false,
|
||||
valid: false,
|
||||
@ -153,32 +155,32 @@ export default {
|
||||
link: null,
|
||||
repo: null,
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
pageNum() {
|
||||
return Math.ceil(this.filteredPlugins.length / 10)
|
||||
return Math.ceil(this.filteredPlugins.length / 10);
|
||||
},
|
||||
filteredPlugins() {
|
||||
return this.plugins.filter((plugin) => {
|
||||
return (
|
||||
plugin.id.indexOf(this.filterText || '') != -1 ||
|
||||
plugin.name.indexOf(this.filterText || '') != -1 ||
|
||||
plugin.desc.indexOf(this.filterText || '') != -1 ||
|
||||
plugin.author.indexOf(this.filterText || '') != -1
|
||||
)
|
||||
})
|
||||
plugin.id.indexOf(this.filterText || "") != -1 ||
|
||||
plugin.name.indexOf(this.filterText || "") != -1 ||
|
||||
plugin.desc.indexOf(this.filterText || "") != -1 ||
|
||||
plugin.author.indexOf(this.filterText || "") != -1
|
||||
);
|
||||
});
|
||||
},
|
||||
displayPlugins() {
|
||||
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10)
|
||||
return this.filteredPlugins.slice((this.page - 1) * 10, this.page * 10);
|
||||
},
|
||||
publishPlugin() {
|
||||
if (!this.$refs.newPluginForm.validate()) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
const title = encodeURIComponent(
|
||||
`Plugin: ${this.newPlugin.name}`
|
||||
).replace(/%2B/gi, '+')
|
||||
).replace(/%2B/gi, "+");
|
||||
const body = encodeURIComponent(
|
||||
`
|
||||
**插件名称:**
|
||||
@ -210,11 +212,11 @@ ${this.newPlugin.repo}
|
||||
- repo: ${this.newPlugin.repo}
|
||||
-->
|
||||
`.trim()
|
||||
).replace(/%2B/gi, '+')
|
||||
).replace(/%2B/gi, "+");
|
||||
window.open(
|
||||
`https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Plugin`
|
||||
)
|
||||
);
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
@ -34,7 +34,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import copy from 'copy-to-clipboard'
|
||||
import copy from "copy-to-clipboard";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -49,28 +49,28 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
snackbar: false,
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
showCommand() {
|
||||
return this.text && this.command
|
||||
return this.text && this.command;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
repoLink(repo) {
|
||||
if (repo) {
|
||||
return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`
|
||||
return /^https?:/.test(repo) ? repo : `https://github.com/${repo}`;
|
||||
}
|
||||
return null
|
||||
return null;
|
||||
},
|
||||
copyCommand() {
|
||||
copy(this.command, {
|
||||
format: 'text/plain',
|
||||
})
|
||||
this.snackbar = true
|
||||
format: "text/plain",
|
||||
});
|
||||
this.snackbar = true;
|
||||
},
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
@ -28,12 +28,12 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Adapter from './Adapter.vue'
|
||||
import Plugin from './Plugin.vue'
|
||||
import Bot from './Bot.vue'
|
||||
import Adapter from "./Adapter.vue";
|
||||
import Plugin from "./Plugin.vue";
|
||||
import Bot from "./Bot.vue";
|
||||
|
||||
export default {
|
||||
name: 'Store',
|
||||
name: "Store",
|
||||
components: {
|
||||
Adapter,
|
||||
Plugin,
|
||||
@ -43,15 +43,15 @@ export default {
|
||||
return {
|
||||
tab: 1,
|
||||
tabs: {
|
||||
0: '协议',
|
||||
1: '插件',
|
||||
2: '机器人',
|
||||
0: "协议",
|
||||
1: "插件",
|
||||
2: "机器人",
|
||||
},
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {},
|
||||
methods: {},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -38,7 +38,8 @@ AweSome-Bot
|
||||
如果您使用如 `VSCode` / `PyCharm` 等 IDE 启动 nonebot,请检查 IDE 当前工作空间目录是否与当前侧边栏打开目录一致。
|
||||
|
||||
- 注意:在二者不一致的环境下可能导致 nonebot 读取配置文件和插件等不符合预期
|
||||
:::
|
||||
|
||||
:::
|
||||
|
||||
通过 `nb-cli`
|
||||
|
||||
|
@ -17,8 +17,8 @@
|
||||
"scripts": {
|
||||
"dev": "vuepress dev docs",
|
||||
"build": "vuepress build docs",
|
||||
"lint": "npx prettier -c docs/**/* !docs/api/**/*",
|
||||
"lint:fix": "npx prettier --write docs/**/* !docs/api/**/*"
|
||||
"lint": "npx prettier --config .prettierrc -c docs/**/* !docs/api/**/*",
|
||||
"lint:fix": "npx prettier --config .prettierrc --write docs/**/* !docs/api/**/*"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
|
Loading…
Reference in New Issue
Block a user