我有一个错误,我无法解决 错误是标题 我已经在其他情况下进行了测试
<ion-icon class="liked" (click)="toggleLikeState(feed);$event.stopPropagation();"
tappable name="{{feed.IsLike ? 'heart' : 'heart-empty'}}">
</ion-icon>
toggleLikeStates(feed: Feed) {
this.storage.get('userID').then(async (loggedinUId) => {
const value: UserLikedPost = {
LoginUserId: loggedinUId,
UserId: UserId,
PostId: PostId
};
this.apiService.postLike(value).then(
async (success) => {
console.log("success", success);
feed.IsLike = !feed.IsLike;
feed.IsLike ? feed.LikesCount++ : feed.LikesCount--;
}, (error) => {
console.log("Error", error);
});
});
}
答案 0 :(得分:0)
齿轮中的命令仍然是齿轮实例的方法。传递给他们的第一个参数始终是实例
class utility(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_ready(self):
print("Cog utility pronto!")
@commands.command()
async def ping(self, ctx):
await ctx.send(f"Pong! {round(self.client.latency * 1000)}ms")
@commands.command()
async def clear(self, ctx, amount=5):
await ctx.channel.purge(limit=amount)
await ctx.send(f"{amount}Messaggi eliminati")