我有以下代码:
<template>
<div>
<DxDataGrid :dataSource="viewerRoles">
<DxColumn data-field="name"
caption="Ansicht" />
<DxColumn data-field="description"
caption="Beschreibung" />
<DxColumn type="buttons">
<DxButton icon="preferences"
@click="test" />
</DxColumn>
</DxDataGrid>
<button @click="test"></button>
</div>
</template>
<script>
import { DxDataGrid, DxColumn, DxButton } from 'devextreme-vue/data-grid'
export default {
name: 'Test',
components: {
DxDataGrid, DxColumn, DxButton
},
data() {
return {
viewerRoles: []
}
},
async created() {
const svcResp = await this.$http.get('Settings/ViewerRoles');
if (svcResp.status === 200)
this.viewerRoles = svcResp.data;
},
methods: {
test() { alert('') }
}
}
</script>
奇怪的是,如果我点击 HTML <button>
,浏览器会显示警报。但在 上<DxButton>
,它没有。据我所知,调试控制台中没有错误。
我的代码有什么问题?