Skip to content

Commit

Permalink
add exmaple codes
Browse files Browse the repository at this point in the history
  • Loading branch information
fs-context committed Nov 30, 2024
1 parent cdbf163 commit 0d1e39c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion config/loader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type LoaderConfig = import("@framework/internal").LoaderConfig;
const config: LoaderConfig = {
target: import("@samples/falling-anchors/extension"),
target: import("@src/extension"),
errorCatches: [],
platform: ["TurboWarp"]
}
Expand Down
13 changes: 12 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ export default class MyExtension extends Extension {
{ name: "香蕉", value: "banana" },
{ name: "橙子", value: "orange" },
{ name: "西瓜", value: "watermelon" }
])
]),
new Menu("vegetables", [
"土豆=potato",
"胡萝卜=carrot",
"Unnamed vegitable",
{
name: "Named vegitable of Onion",
value: "onion"
},
"Cabbage白菜"
]),
new Menu("sauces", "番茄酱=ketchup,蛋黄酱=mayonnaise,mushroom,辣椒酱=hot sauce")
]
description = translator.load("des");
collaborators = [
Expand Down
14 changes: 7 additions & 7 deletions src/fs-context/samples/falling-anchors/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,19 @@ export default class FallingAnchors extends Extension {
];
menus = [
new Menu("exampleA", "abc,defg,gh,i"),
new Menu("exampleB", " abc = ABCaaabcc, defg, gh =GH,i= I"),
new Menu("exampleB", "abc=ABCaaabcc,defg,gh=GH,i=I"),
new Menu("exampleC", [
"abcdefg ",
" hijklmnop",
"abcdefg",
"hijklmnop",
{
name: " qwer",
value: " QWER"
name: "qwer",
value: "QWER"
},
{
name: "asdf ",
name: "asdf",
value: "ASDF"
},
"zxcv= APple"
"zxcv=APple"
])
];
init(runtime: Scratch) {
Expand Down
5 changes: 2 additions & 3 deletions src/fs-context/ui/componets/WaterBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default {
},
methods: {
findMenu(id) {
return id instanceof Menu ? id : this.menus.find(m => m.id === id);
return id instanceof Menu ? id : this.menus.find(m => m.name === id);
},
reloadExtension() {
this.extensionLoaded = false;
Expand All @@ -68,8 +68,7 @@ export default {
this.extId = ext.id;
setTimeout(() => {
this.extensionLoaded = true;
console.log(this.$refs);
}, 500);
}, 100);
});
},
copyExtensionUrl() {
Expand Down

0 comments on commit 0d1e39c

Please sign in to comment.