我尝试了这个实现完整日历实现.
$("#available_classes_calendar").fullCalendar({
header: {
left : 'prev,next',
center : 'title'
},
defaultView: 'agendaWeek',
views:{
agenda:{
allDaySlot: false,
minTime: "06:30:00",
maxTime: "24:00:00",
slotDuration: "00:60:00"
}
}
});
Run Code Online (Sandbox Code Playgroud)
在这个全天列应该从早上6:30开始,间隔时隙应该是1小时.
因此,全天列应如下所示:
早上6:30,早上7:30,上午8:30...晚上11:30
我尝试了很多解决方案,但无法实现这一目标.
如果需要任何其他信息来解决此问题,请与我们联系.
谢谢
我在使用Action Cable时遇到问题,每当我运行我的程序时,我都会收到一条错误,指出Subscription
找不到ClassConversationChannel
当我尝试发送消息时,我得到了这个日志
已成功升级到WebSocket(REQUEST_METHOD:GET,HTTP_CONNECTION:Upgrade,HTTP_UPGRADE:websocket)未找到订阅类:"ConversationChannel"无法从{"command"=>"message","identifier"=>"{\"channel执行命令\":\"ConversationChannel \"}","data"=>"{\"message \":[{\"name \":\"conversation_id \",\"value \":\"2 \"} {\ "名称\":\ "amitian_id \",\ "值\":\ "1 \"},{\ "名称\":\ "身体\",\ "值\":\"NMM\"}],\"action \":\"speak \"}"}} [RuntimeError - 无法找到带标识符的订阅:{"channel":"ConversationChannel"}]:C:/RailsInstaller/Ruby2.3.0/lib /ruby/gems/2.3.0/gems/actioncable-5.0.1/lib/action_cable/connection/subscriptions.rb:74:in
find' | C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.1/lib/action_cable/connection/subscriptions.rb:53:in
perform_action'| C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.1/lib/action_cable/connection/subscriptions.rb:17:inexecute_command' | C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.1/lib/action_cable/connection/base.rb:88:in
dispatch_websocket_message'| C:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/actioncable-5.0.1/lib/action_cable/server/worker.rb:58:在`block in invoke'中
ConversationChannel.rb
class ConversationChannel < ApplicationCable::Channel
def subscribed
# stream_from "some_channel"
stream_from "conversations-#{current_amitian.id}"
end
def unsubscribed
# Any cleanup needed when channel is unsubscribed
stop_all_streams
end
def speak(data)
message_params = data['message'].each_with_object({}) do |el, hash|
hash[el.values.first] = el.values.last
end
ActionCable.server.broadcast(
"conversations-#{current_amitian.id}", …
Run Code Online (Sandbox Code Playgroud) ruby ruby-on-rails ruby-on-rails-3 ruby-on-rails-4 actioncable
我想在当前列旁边添加 TD 和 TH。这应该在我点击链接时添加。
这是 HTML:
<section class="yield-report-table">
<table id="sorting">
<tr class="headerrow ui-sortable">
<th class="ui-resizable tac"><div class="ui-resizable">First Year Corn <br>Non Limited N, High Pop(1)</div></th>
<th class="ui-resizable tac"><div class="ui-resizable">First Year Corn <br>Non Limited N, High Pop(2)</div></th>
</tr>
<tr>
<td>
<div class="report-icon-list bg-l-green">
<a href="#" class="cht-add"><span><i class="cht-sprite">1</i></span></a>
</div>
</td>
<td>
<div class="report-icon-list bg-l-green">
<a href="#" class="cht-add"><span><i class="cht-sprite">2</i></span></a>
</div>
</td>
</tr>
</table>
</section>
Run Code Online (Sandbox Code Playgroud)
JS:
<script>
$(function() {
$('.report-icon-list .cht-add').on("click",function(){
$i = $(".report-icon-list .cht-add").parents("td").index(this);
$n = $(".report-icon-list .cht-add").parents("#sorting tr th").index(this);
$(this).parents("td:eq("+$i+")").after("<td>discription</td>");
$("#sorting tr th:eq("+$n+")").after("<th>heading</th>"); …
Run Code Online (Sandbox Code Playgroud) 我遵循了其他主题的建议,但无法让它发挥作用。我想设置背景图片。
我的 scss 文件是 custom.css.scss 和代码是正文
{ background-image: url("back.png"); }
back.png
位于 app/assets/images
custom.css.scss
位于 app/stylesheets
我没有问题让 back.png 通过我的 html 页面中的资产管道工作
<%= image_tag "back.png" %>
我正在为图像构建一个延迟加载组件.但我设置状态有问题.我得到的只能更新已安装或安装的组件错误,但我在setState
里面使用componentDidMount
,这应该可以让我避免这样的错误.
这是我的代码:
export default class Images extends React.Component {
constructor(props) {
super(props);
this.element = null;
this.state = {
loaded: false,
height: 0
};
}
componentDidMount() {
this.element = findDOMNode(this);
this.loadImage();
}
getDimensions() {
const w = this.element.offsetWidth;
let initw = 0;
let inith = 0;
let result;
const img = new Image();
img.src = this.props.url;
img.onload = (e) => {
initw = e.path[0].width;
inith = e.path[0].height;
result = (w / initw) * inith;
setTimeout(() …
Run Code Online (Sandbox Code Playgroud) 我在项目中使用蚂蚁设计。
在这里,我有一个选择作为动态字段。当我尝试为select设置默认值时。没用
<Select defaultValue="lucy">
<Option value="jack">Jack</Option>
<Option value="lucy">Lucy</Option>
<Option value="Yiminghe">yiminghe</Option>
</Select>
Run Code Online (Sandbox Code Playgroud)
我将defaultvalue设置为,lucy
但不起作用
我想做一个功能,用户每天只能领取一次硬币。我做了这个函数,.split
以便它只比较日期,因为Date()
只比较日期和时间。但是,我收到了这个 javascript 错误:
未捕获的 TypeError(中间值)。split 不是函数
有谁知道如何解决这个问题?我尝试了很多方法。错误仍然存在。
这是我的代码:
$(document).ready(function () {
if (new Date(model[0].lastClaimedDate).split(' ')[0] < new Date().split(' ')[0]) {
document.getElementById('btnAddCoins').disabled = false;
}
else {
document.getElementById('btnAddCoins').disabled = true;
}
})
Run Code Online (Sandbox Code Playgroud) 例如,如果元素是'hi'
,而N是3
,我需要一个可以在SELECT
返回以下数组的查询中使用的 PostgreSQL 片段:
['hi', 'hi', 'hi']
Run Code Online (Sandbox Code Playgroud) 当我尝试将数据发送到变量dataStr
然后我console print
在应用程序组件中它返回undefined;
如何将数据从主组件传递到应用程序组件?
app.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'main',
templateUrl: 'app.component.html'
})
export class AppComponent implements OnInit {
public dataStr: string;
setDataStr(dataStr) {
console.log(dataStr);
}
}
Run Code Online (Sandbox Code Playgroud)
app.component.html
<router-outlet (dataStr)="setDataStr($event)"></router-outlet>
Run Code Online (Sandbox Code Playgroud)
home.component.ts
import { Component, OnInit, Output, EventEmitter } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'home-page',
template: `<h1>Test</h1>`
})
export class HomeComponent implements OnInit {
@Output()
dataStr = new EventEmitter();
ngOnInit() { …
Run Code Online (Sandbox Code Playgroud) 我们正在使用 React Final Form 库,并希望更改用户选择的嵌套字段的值。
它基本上是地址形式,在选择 时Suburb
,我想更改postcode
和state
。address 又是一个嵌套的表单对象。我的数据集看起来像:-
{
name: 'xyzx',
address: {
suburb: 'xx',
},
}
Run Code Online (Sandbox Code Playgroud)
我正在通过以下 mutator
export const changeValueMutator: Mutator = ([name]: string[], state: MutableState, { changeValue }: Tools) => {
console.log(state, name);
changeValue(state, name, value => (value));
};
Run Code Online (Sandbox Code Playgroud)
并将其称为
this.props.changeValue('address.suburb', item.suburb);
Run Code Online (Sandbox Code Playgroud) javascript ×6
reactjs ×3
jquery ×2
actioncable ×1
angular ×1
antd ×1
fullcalendar ×1
html ×1
postgres-9.6 ×1
postgresql ×1
ruby ×1