laravel - Laravel Jetstream - 惯性 - 按钮组件不响应点击事件
问题描述
<jet-button class="bg-green-600 m-auto"
@click="creatingProductCategory = true"
>Create New</jet-button>
<jet-dialog-modal :show="creatingProductCategory" @close="creatingProductCategory = false">
<template #title>Create New Product</template>
<template #content>
<form @submit.prevent="submit">
<div>
<jet-label for="email" value="Product Category"/>
<select name="" id=""
class="block w-full border-gray-300 focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50 rounded-md shadow-sm"
>
<option value="1">Macrame</option>
<option value="2">Coords</option>
<option value="3">Plant</option>
<option value="4">Accessories</option>
</select>
</div>
<div class="mt-4">
<jet-label for="email" value="Product Name"/>
<jet-input id="email" type="email" class="mt-1 block w-full" v-model="form.email"
placeholder="Enter Product Name"
required autofocus/>
</div>
<div class="mt-4">
<jet-label for="password" value="Price"/>
<jet-input id="password" type="password" class="mt-1 block w-full"
placeholder="Enter Price"
v-model="form.password" required autocomplete="current-password"/>
</div>
<div class="flex items-center justify-end mt-4">
<jet-button class="ml-4" :class="{ 'opacity-25': form.processing }"
:disabled="form.processing">
Create
</jet-button>
</div>
</form>
</template>
</jet-dialog-modal>
这是我在 jetstream 模板中使用的按钮组件。但是当我单击按钮时,变量“creatingProductCategory”的值不会改变。我在这里遗漏了一些重要的东西!此外,如果您有一些好的文档的链接,那将有很大的帮助:)
解决方案
正如Rwd在评论中提到的,您需要将.native添加到 @click:
<jet-button type="button" @click.native="someFunction" class="mr-4">
press button
</jet-button>
推荐阅读
- python-3.x - NameError:使用 Jupyter Lab 时未定义名称“系列”
- android - Flutter应用程序在使用flutter_driver运行时无法加载Json文件
- python - 元素树python中具有属性的xpath表达式
- amazon-web-services - AWS - 元数据被设置为小写
- mongodb - MongoDB:重命名集合中的字段(文档和子文档)
- sql - 使用 oracle SQL 连接列
- angular - AWS ECS 替换 Dockerize Angular 应用程序中的环境变量
- android - 在 Android 10 上从 URI 获取文件路径,
- javascript - 如何将 URI 转换为 Blob,反之亦然?
- asp.net-core-2.2 - 数据级授权 (ASP.NET Core 2.2)