我已经在stackoverflow中尝试了几个答案,但无济于事使它无法工作..我是Chart.js的新手,所以请耐心等待.
这是我到目前为止所尝试的. 将逗号添加到ChartJS数据点和此Chart.js数字格式
这是我的代码:
提前致谢.
Chart.defaults.global.legend = {
enabled: false
};
function load_yearly_sales_per_agent(param_year, transaction_url){
$(".custom_loader").show();
$(".custom_graph").hide();
$.ajax({
url:transaction_url,
type:'post',
data: {year : param_year},
dataType:'json',
success:function(result){
// Bar chart
var ctx = document.getElementById("mybarChart");
var mybarChart = new Chart(ctx, {
responsive: true,
multiTooltipTemplate: "<%=addCommas(value)%>",
type: 'bar',
data: {
labels: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
datasets: [{
label: 'Sales Per Month',
backgroundColor: "#26B99A",
data: result
}]
},
options: {
scales: {
yAxes: [{
ticks: …Run Code Online (Sandbox Code Playgroud) 我将直接切入正题,我正在使用 VUEJS 创建一个注册表单。但是,当我尝试全局注册组件时,它给了我错误。请耐心等待,我还是 vuejs 的新手。
当我检查控制台时,它给了我这个错误:
n 不是函数
在此先感谢您的帮助。
这是我的代码:
index.php 文件
<section id="app" class="homepage">
<div class="content">
<?php
$this->load->view($content);
?>
</div>
</section>
<script src="<?php echo base_url(); ?>/js/vue.min.js" ></script>
<script src="<?php echo base_url(); ?>/js/vue-resource.min.js" ></script>
<script src="<?php echo base_url(); ?>/js/app.js" ></script>
Run Code Online (Sandbox Code Playgroud)
app.js 文件
Vue.component("tour-form", './components/tourForm.vue');
const app = new Vue({
el:'#app',
data(){
return{
}
}
});
Run Code Online (Sandbox Code Playgroud)
Tour_form.php 文件
<tour-form></tour-form>
Run Code Online (Sandbox Code Playgroud) 我想要实现的是将悬停效果放在光标的位置上..
像这样的东西:http://drmportal.com/
这是一个小提琴:http://jsfiddle.net/onnmwyhd/
这是我的代码.
HTML
<div id="container"></div>
Run Code Online (Sandbox Code Playgroud)
CSS
#container{
background-color: #6fc39a;
height:200px;
}
Run Code Online (Sandbox Code Playgroud)
JQUERY
$("#container").mousemove(function(e){
var x = e.pageX - this.offsetLeft;
var y = e.pageY - this.offsetTop;
$(this).html("X: " + x + " Y: " + y);
});
Run Code Online (Sandbox Code Playgroud)
这是我想要的光标位置的颜色....
background-image: -webkit-linear-gradient(-35deg, #35a28e, #a8e4a5);
Run Code Online (Sandbox Code Playgroud) 我直接说到这里,我想知道是否有可能validation rule在Laravel中传递参数。
这是我的代码:
我需要$product->id将ProductUpdateRequest课程传递给全班。
我已经阅读了一些文章,但无济于事不能将参数传递给它。我的另一种解决方案是不使用验证规则类,而通过使用直接在控制器上进行验证$request->validate[()]。由于我可以访问$product->id控制器上的,因此可以轻松进行验证。但出于好奇是有我的方式来传递$product->id的validation class?
控制器
public function update(ProductUpdateRequest $request, Product $product)
{
$request['detail'] = $request->description;
unset($request['description']);
$product->update($request->all());
return response([
'data' => new ProductResource($product)
], Response::HTTP_CREATED);
}
Run Code Online (Sandbox Code Playgroud)
验证规则
public function rules()
{
return [
'name' => 'required|max:255|unique:products,name'.$product->id,
'description' => 'required',
'price' => 'required|numeric|max:500',
'stock' => 'required|max:6',
'discount' => 'required:max:2'
];
}
Run Code Online (Sandbox Code Playgroud)
任何建议/答案/帮助将不胜感激。
我是vb.net的新手..很抱歉提前.任何人都可以帮我解决我的elseif代码行的问题.
Dim con As SqlConnection = New SqlConnection("Data Source=PC11-PC\kim;Initial Catalog=ordering;User ID=sa;Password=123")
Dim cmd1 As SqlCommand = New SqlCommand("Select * from Customer", con)
Dim first1 As String
Dim second2 As String
first1 = "FirstName"
second2 = "LastName"
con.Open()
If TextBox1.Text = "" Or TextBox2.Text = "" Then
MsgBox("Please fill-up all fields!", MsgBoxStyle.Exclamation, "Add New Customer!")
'this will supposedly display error message for "User Already Exist"
' ElseIf textbox1.text = first1 and textbox2.text = second2 Then
' MsgBox("User Already Exist!", MsgBoxStyle.Exclamation, "Add …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取单击的行的单元格值。
这是我的代码。
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
txtFullName.Text = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
txtUsername.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
txtPassword.Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
}
Run Code Online (Sandbox Code Playgroud)
工作正常..但是当我单击行(用户ID的左侧)和用户ID列时,它不起作用...当我单击列标题时,它也给我一个错误。如何解决该错误,我还希望它也单击行和用户ID列。
我可以设置input = 'month'使用php 的值吗?我已经看到有可能使用javascript ..但我想使用php ....
我正在尝试为input = month.. 设置默认值,但是我设置的值没有生效。
这就是我所做的。
当我尝试将其显示在元素外时,<?=date('F-Y')?>它可以很好地显示日期和月份。
<input type="month" value="<?=date('F-Y')?>" class="form-control per_date_inputs" name="month"/>
Run Code Online (Sandbox Code Playgroud) 我直截了当地说到这一点.
我试图显示Monthly Income只有2位小数.
我尝试过使用DisplayFormat但是当我在Textbox上添加它时它不起作用.
模型
public class AgentModel
{
[Display(Name = "Monthly Income")]
[DisplayFormat(DataFormatString = "{0:0.00}", ApplyFormatInEditMode = true)]
public decimal MonthlyIncome { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
视图
//this input display the two decimal
@Html.EditorFor(m => m.MonthlyIncome, new { htmlAttributes = new { @class = "form-control" } })
//this one display 5 decimal
@Html.TextBoxFor(m => m.MonthlyIncome, new { @class = "form-control"})
Run Code Online (Sandbox Code Playgroud)
我很困惑这两个输入之间有什么区别.我正在使用,DataFormat因为我希望格式集中在我的模型上.并且不使用此代码@string.Format("{0:N2}",decimal.Round(agent.MonthlyIncome, 2, MidpointRounding.AwayFromZero))来限制小数位.因为如果我这样做,我会在所有观点中这样做.
我也尝试输出值 monthly income
<td>@agent.MonthlyIncome</td>
Run Code Online (Sandbox Code Playgroud)
这仍然返回5位小数.
mouseenter如果语句$("."+ElementID+"-delta-ui-dropdown-appendHere").attr('style') == 'display: block;'){为false ,我有一个从元素中删除类的事件.
它完美地工作,直到我添加了一个通过调整浏览器大小触发的事件.最初加载时,mouseenter事件工作正常,但是当我调整浏览器大小时,mouseenter即使条件为真,事件也会删除该类.
如果我删除$(window).resize代码,该mouseenter事件将再次起作用.
//this is the code triggered
var getWidth = $("."+ElementID+"-delta-ui-dropdown-appendHere").outerWidth();
$(window).resize(function() {
// This will execute whenever the window is resized
if ($(window).width() >= 992) {
console.log('original');
$(".delta-ui-dropdown-common-"+ElementID+"").css({width:getWidth});
} else {
var inputGroupWidth = $(".delta-ui-dropdown-"+ElementID+"").width();
$(".delta-ui-dropdown-common-"+ElementID+"").css({width:inputGroupWidth});
console.log('fit');
}
});
//this code removes the class even though the condition is true
$('.delta-ui-dropdown-icon-'+ElementID).mouseenter(function() {
if ($("."+ElementID+"-delta-ui-dropdown-appendHere").attr('style') == 'display: block;') {
} else {
$('.delta-ui-dropdown-icon-'+ElementID).removeClass('focus');
} …Run Code Online (Sandbox Code Playgroud) 我对 vuejs 很陌生,我想知道是否可以通过单击表格行来触发复选框。
这是一把小提琴供你演奏。 https://jsfiddle.net/50wL7mdz/265410/
超文本标记语言
<div id="app">
<table>
<tbody>
<tr v-for="cat in categories" @click="selectCat(cat)">
<td><input type="checkbox" :value="cat" v-model="selected" name="" id=""></td>
<td>{{ cat.code}}</td>
<td>{{ cat.name }}</td>
</tr>
</tbody>
</table>
<button @click="checkData()">Check</button>
</div>
Run Code Online (Sandbox Code Playgroud)
虚拟联合体
new Vue({
el: '#app',
data() {
return {
categories: [
{code:'HW', name:'Hardware'},
{code:'SW', name:'Software'},
{code:'OS', name:'Office Supplies'}
],
selected:[]
}
},
methods:{
selectCat(cat){
this.selected.push(cat);
},
checkData(){
alert(1);
console.log(this.selected);
}
}
})
Run Code Online (Sandbox Code Playgroud)
提前致谢。
javascript ×3
jquery ×3
c# ×2
vue.js ×2
asp.net ×1
asp.net-mvc ×1
charts ×1
css ×1
datagridview ×1
html ×1
html5 ×1
laravel ×1
laravel-5.5 ×1
php ×1
vb.net ×1
vuejs2 ×1