我使用库:https://www.npmjs.com/package/react-edittext。我尝试text-decoration: line-through从编辑按钮中删除,当我从取消和提交按钮按下编辑按钮时。它试图赋予按钮text-decoration: none !important样式,但删除线不会从按钮上消失。演示在这里:https : //stackblitz.com/edit/react-dmfbqc图片:https : //imgur.com/O5hb715CSS.lineThrough { text-decoration: line-through;}.styles_Editext__button__6H8n_, .styles_Editext__edit_button__hthOZ { text-decoration: none !important;}.styles_Editext__save_button__3WN6q { text-decoration: none !important;}.styles_Editext__cancel_button__259hb { text-decoration: none !important;}javascriptimport React, { Component } from 'react';import { render } from 'react-dom';import './style.css';import EdiText from 'react-editext'class App extends Component { constructor() { super(); this.state = { name: 'React' }; } onSave = val => { console.log('Edited Value -> ', val) } render() { return ( <div className="lineThrough"> <EdiText type="text" value='What is real? How do you define real?' onSave={this.onSave} /> </div> ); }}
2 回答
宝慕林4294392
TA贡献2021条经验 获得超8个赞
可能是这样:
您尚未导入
.js
文件中所需的所有内容。或者你还没有定义你的
onSave()
函数。就像是 :onSave = val => { console.log('Edited Value -> ', val) }
添加回答
举报
0/150
提交
取消