mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-17 08:54:19 +08:00
修改pinyin-match引用,改为从preload中导入
This commit is contained in:
@@ -72,7 +72,6 @@
|
||||
<script>
|
||||
import { defineComponent } from "vue";
|
||||
import { commandCategories } from "js/composer/composerConfig";
|
||||
import pinyinMatch from "pinyin-match";
|
||||
|
||||
export default defineComponent({
|
||||
name: "ComposerList",
|
||||
@@ -107,8 +106,8 @@ export default defineComponent({
|
||||
commands: this.commands
|
||||
.filter(
|
||||
(cmd) =>
|
||||
(cmd.label && pinyinMatch.match(cmd.label, query)) ||
|
||||
(cmd.value && pinyinMatch.match(cmd.value, query))
|
||||
(cmd.label && window.pinyinMatch.match(cmd.label, query)) ||
|
||||
(cmd.value && window.pinyinMatch.match(cmd.value, query))
|
||||
)
|
||||
.filter((cmd) => cmd.type === category.label),
|
||||
}))
|
||||
@@ -151,7 +150,7 @@ export default defineComponent({
|
||||
highlightText(text) {
|
||||
if (!this.searchQuery) return text;
|
||||
|
||||
const matches = pinyinMatch.match(text, this.searchQuery);
|
||||
const matches = window.pinyinMatch.match(text, this.searchQuery);
|
||||
if (!matches) return text;
|
||||
|
||||
const [start, end] = matches;
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
<script>
|
||||
import CommandCard from "components/CommandCard.vue";
|
||||
import draggable from "vuedraggable";
|
||||
import pinyinMatch from "pinyin-match";
|
||||
import { useCommandManager } from "js/commandManager.js";
|
||||
import { dbManager } from "js/utools.js";
|
||||
|
||||
@@ -153,7 +152,7 @@ export default {
|
||||
commands.forEach((cmd) => {
|
||||
// 拼音搜索
|
||||
let explain = cmd.features.explain;
|
||||
let matchedWordPositions = pinyinMatch.match(
|
||||
let matchedWordPositions = window.pinyinMatch.match(
|
||||
explain,
|
||||
this.commandSearchKeyword
|
||||
);
|
||||
|
||||
@@ -86,8 +86,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pinyinMatch from "pinyin-match";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -116,12 +114,12 @@ export default {
|
||||
|
||||
return this.items.filter((x) => {
|
||||
if (this.is.json) {
|
||||
const titleMatch = pinyinMatch.match(x.title, this.searchWords);
|
||||
const titleMatch = window.pinyinMatch.match(x.title, this.searchWords);
|
||||
const descMatch =
|
||||
x.description && pinyinMatch.match(x.description, this.searchWords);
|
||||
x.description && window.pinyinMatch.match(x.description, this.searchWords);
|
||||
return titleMatch || descMatch;
|
||||
} else {
|
||||
return pinyinMatch.match(x, this.searchWords);
|
||||
return window.pinyinMatch.match(x, this.searchWords);
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -237,7 +235,7 @@ export default {
|
||||
highlightText(text) {
|
||||
if (!text || !this.searchWords) return text;
|
||||
|
||||
const matchInfo = pinyinMatch.match(text, this.searchWords);
|
||||
const matchInfo = window.pinyinMatch.match(text, this.searchWords);
|
||||
if (!matchInfo) return text;
|
||||
|
||||
let result = text;
|
||||
|
||||
Reference in New Issue
Block a user