v-model input的数据双向绑定
const App = {
setup() {
let visible = ref('');
return { visible };
},
render() {
return (
<input v-model={[this.visible,'value']} />
);
},
};
事件绑定
const App = {
setup() {
let tableTitle = [
{
title: '报表种类',
dataIndex: 'reportType',
width: '50%'
},
{
title: '操作',
dataIndex: 'handle',
width: '50%',
slots: {
customRender: 'operation'
}
}
];
let tableItem = ref([
{
key:'1',
reportType:'报表内容1',
}
])
const clickHandle = ()=>{
console.log('1');
}
const deleteHandle = ()=>{
console.log('2');
}
return { clickHandle,deleteHandle,tableTitle,tableItem};
},
render() {
const Slot = {
operation: ({ record }) => {
return (
<div>
<span
style={{ marginRight: '10px', cursor: 'pointer', color: '#1890ff' }}
onClick={() => {
this.deleteHandle(record);
}}
>
删除
</span>
</div>
);
}
};
return (
<div>
<a-table columns={this.tableTitle} data-source={this.tableItem}></a-table>
<span onClick={this.clickHandle}>点击了我</span>
</div>
);
},
};