我在WordPress v4.9.8中安装了Gutenberg插件,我正在尝试删除随附的CSS,以便我可以自己提供.
这是包含的表格:
__CODE__
我尝试过以下方法:
<link rel='stylesheet' id='wp-block-library-css' href='/wp-content/plugins/gutenberg/build/block-library/style.css?ver=1535795173' type='text/css' media='all' />
Run Code Online (Sandbox Code Playgroud)
除了这个的变化,但文件仍然存在.我该如何删除它?
我有一个路由设置来渲染组件:
<Route exact path="/page/:id" location={this.props.location} key={this.props.location.key} render={({ location }) => (
<PageStart key={this.props.location.key} />
)} />
Run Code Online (Sandbox Code Playgroud)
然后在那个组件(PageStart)中我有:
this.props.match.params.id
Run Code Online (Sandbox Code Playgroud)
但它抛出一个错误:
Cannot read property 'params' of undefined
Run Code Online (Sandbox Code Playgroud)
简单调用时传递道具component={}似乎工作正常但不在渲染功能中.为什么?
这应该很简单,但我找不到我想要的简单答案.我有一个减速器:
const posts = (state = null, action) => {
switch(action.type){
case "PUBLISH_POST":
return state;
case "UNPUBLISH_POST":
return state;
default:
return postList;
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个帖子列表ID's和a status.我正在发送我的帖子ID但是无法找出简单地将status已经点击的项目从0 更新为1 的逻辑.我发现了很多半解决方案,但它们看起来都很冗长和丑陋 - 在这种情况下实现它的最短/最佳方式是什么?
示例数据:
{
id:1,
user:"Bob Smith",
content:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque vulputate mauris vitae diam euismod convallis. Donec dui est, suscipit at dui vitae, sagittis efficitur turpis. ",
status:1
}
Run Code Online (Sandbox Code Playgroud) 我正在用这个敲打墙 - 我对使用API相对较新,还没有做任何需要身份验证的事情.
我坚持向API发送POST请求.创建内容的端点是:
/entity/node
Run Code Online (Sandbox Code Playgroud)
如果我发送以下内容,我可以发送成功的POST请求:
headers: {
"Authorization": "Basic YWRtaW46MTIzcXdl", //admin:123qwe
},
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是授权.我在这里指定Basic,然后是编码字符串,这是我的管理员登录.因此,当硬编码时,我可以发布.
我的问题 - 当用户正确登录时,我需要设置标题,以便将来所有的帖子请求都能正常工作.我怎样才能在AngularJS中做到这一点?
我试过传递一个动态生成的代码:
"Authorization": "Basic " + auth,
Run Code Online (Sandbox Code Playgroud)
其中auth是base64编码的用户:pass,但这不起作用.我的想法是,无论何时发出POST请求,都需要将此值存储在某处以供检索.但是怎么样?
我设置了一条路线:
<Route path="/search/:name" component={foo} />
Run Code Online (Sandbox Code Playgroud)
在一个组件中,我试图根据输入的名称进行重定向:
<Redirect to="/search" />
Run Code Online (Sandbox Code Playgroud)
我想传递this.state.name给重定向,例如/search/name。怎么样?
我正在使用redux thunk来返回操作的API调用:
export const getActiveCampaigns = () => {
return (dispatch, getState) => {
const bearer = 'Bearer ' + getState().login.bearer
return axios.get(API.path + 'campaign/active/?website_id=' + getState().selectedWebsite.selectedWebsite + '&' + API.beaconAPI_client, { headers: { 'Authorization': bearer } })
.then(function (response) {
dispatch({
type: GET_ACTIVE_CAMPAIGNS,
activeCampaigns: response.data.response
})
})
}
}
Run Code Online (Sandbox Code Playgroud)
这样做的原理是成功返回广告系列列表,我使用以下命令将其渲染到另一个组件中:
class ActiveCampaignsDropdown extends Component {
// usual stuff
componentDidMount(){
this.props.dispatch(getActiveCampaigns())
}
// render function displays campaigns using this.props.activeCampaigns
}
const mapStateToProps = (state) => {
return {
activeCampaigns: state.activeCampaigns.activeCampaigns …Run Code Online (Sandbox Code Playgroud) 所有Codeigniter控制器似乎都始于:
public function index()
{
// stuff
}
Run Code Online (Sandbox Code Playgroud)
这是一项要求还是仅仅是一种良好做法?我有一个可能不需要索引的实例,例如我有一个名为"Auth"的控制器,其中有一个注册函数和一个登录函数- 你可以说登录函数具有更高的优先级但是在命名约定的兴趣我宁愿命名我的函数.这里的最佳做法是什么?
reactjs ×4
react-router ×2
redux ×2
angularjs ×1
api ×1
chart.js ×1
codeigniter ×1
css ×1
drupal ×1
forms ×1
login ×1
php ×1
redux-thunk ×1
rest ×1
wordpress ×1