我有一个显示我所有数据的简单表:
主文件.php
<table class="table table-bordered table-hover" id="all-jobs">
<thead>
<tr>
<th>{{ __('Job Name') }}</th>
<th>{{ __('Job Description') }}</th>
<th>{{ __('Job Status') }}</th>
<th>{{ __('Job Applications') }}</th>
<th>{{ __('Manage') }}</th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="non_searchable"></td>
<td class="non_searchable"></td>
</tr>
</thead>
</table>
<div id="app">
<div id="editJob" class="modal fade in" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<edit-job id=""></edit-job>
</div>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在,我有一个编辑按钮,我试图打开该特定行的编辑模式:
<a href='' data-id='{$job->id}' class='btn btn-xs btn-danger' data-toggle='modal' data-target='#editJob'><i class='fa fa-close'></i></a>";
Run Code Online (Sandbox Code Playgroud)
href是我的一个数据表中的位置,我试图将它传递给我的.vue文件,所以我可以将它用于我的get和post请求:
myfile.vue
<template>
<div>
<div class="modal-header">
<button type="button" …Run Code Online (Sandbox Code Playgroud) 我是vuejs的新手.我正在尝试创建我的第一个应用程序.我想在每次点击按钮时显示确认消息.
例:
<button class="btn btn-danger" v-on:click="reject(proposal)">reject</button>
Run Code Online (Sandbox Code Playgroud)
我的问题是:我可以扩展v-on:click活动以显示所有地方的确认吗?我会调用我的自定义指令v-confirm-click,首先执行确认,然后,如果我点击"确定",则执行click事件.可能吗?
我有两个表,Table_A和Table_B.Table_A与Table_B具有一对多的关系.
在子表(Table_B)中插入记录后,我想使用触发器从父表(Table_A)中的字段中获取值,并更新Table_B中当前插入的记录.
表-A
PK|EmpID|MemID|Firstname|Lastname
----------------------------------
1 |1234 |AB123|John | Doe
2 |5678 |CD456|Jane | Smith
Run Code Online (Sandbox Code Playgroud)
表-B
PK|EmpID|MemID|Description
---------------------
1 |1234 |NULL |Finance
2 |1234 |NULL |IT
3 |5678 |NULL |Finance
4 |5678 |NULL |Management
Run Code Online (Sandbox Code Playgroud)
触发器应该从Table_A中获取MemID值,并在Table_B中更新它的相应值,其中[Table_A].[EmpID] = [Table_B].[EmpID].当然,在表_B中的4个插入后,结果应如下所示:
PK|EmpID|MemID|Description
---------------------
1 |1234 |AB123|Finance
2 |1234 |AB123|IT
3 |5678 |CD456|Finance
4 |5678 |CD456|Management
Run Code Online (Sandbox Code Playgroud)
我广泛搜索了其他技术站点,但似乎找不到这个特定场景.作为一个绝望的举动,我已经注册到这个网站,这将是我的第一篇求助信.
以下是我尝试在MS SQL Server 2008 R2中创建第一个触发器的徒劳尝试.
CREATE TRIGGER dbo.trgInsMemID
ON dbo.Table_B
AFTER INSERT
AS
BEGIN
UPDATE dbo.Table_B
SET MemID =
(SELECT MemID
FROM inserted i
JOIN dbo.Table_A c ON …Run Code Online (Sandbox Code Playgroud) 我有一系列需要写入SQL的数据,我应该怎么做才能检查SQL中的数据以防止相同的数据插入到表中?
要插入的示例数据:
David
James
John
Run Code Online (Sandbox Code Playgroud)
如果第四个数据John再次出现,我希望系统跳过重复记录(John).
到目前为止,我有:
SqlConnection myCnn = new SqlConnection(cnn);
String _state = "Insert into CamNo1(platename, date, camID, path, filename) OUTPUT INSERTED.platename values(@msg, getdate(), @camID, @path, @filename)";
SqlCommand _Query = new SqlCommand(_state, myCnn);
_Query.Parameters.AddWithValue("@msg", msg);
_Query.Parameters.AddWithValue("@camID", camID);
_Query.Parameters.AddWithValue("@path", imageFile);
_Query.Parameters.AddWithValue("@filename", name);
try
{
myCnn.Open();
string checkname = (string)_Query.ExecuteScalar();
myCnn.Close();
getcheckname = checkname;
Console.WriteLine("OK");
}
catch (Exception)
{
}
Run Code Online (Sandbox Code Playgroud)
我得到了最后插入的字符串值checkname,我应该检查数据?
美好的一天!我正在学习如何使用MediaRecorder录制视频,但录制的视频在播放时已损坏.请参阅此屏幕截图:http://www.4shared.com/photo/QtmJCHRi/corrupted-video.html.在左上角标有红色矩形的图片是相机可以看到的.但它很小,它重复着,还有很多绿色区域.请告诉我我做错了什么.HW是三星Galaxy S2(GT-I9100,Android 2.3.5).我试着按照这个教程:http://developer.android.com/guide/topics/media/camera.html#saving-media
先感谢您!
CameraRecorderActivity.java
package cz.ryvo.android.camerarecorder;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.media.CamcorderProfile;
import android.media.MediaRecorder;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
public class CameraRecorderActivity extends Activity
implements SurfaceHolder.Callback, OnClickListener {
private static final String TAG = "CameraRecorderActivity";
public static final int MEDIA_TYPE_IMAGE = 1;
public static final int MEDIA_TYPE_VIDEO …Run Code Online (Sandbox Code Playgroud) 当 prop 发生变化时,如何强制组件重新渲染?
假设我有一个包含以下内容的组件:
<test-sub-component :layoutSetting="layoutSetting"></test-sub-component>
Run Code Online (Sandbox Code Playgroud)
我的数据对象如下所示:
data() {
return {
layoutSetting: 'large'
}
},
Run Code Online (Sandbox Code Playgroud)
然后,通过单击按钮,我想更改传递的道具的设置,并且组件应该重新渲染,例如
<button @click="changeLayout">Change Layout</button>
Run Code Online (Sandbox Code Playgroud)
和一个像这样的方法
changeLayout() {
this.layoutSetting = 'small';
},
Run Code Online (Sandbox Code Playgroud)
这更改了数据对象,但它不会使用更改后的 prop 重新渲染组件?
我在Vue上有这种奇怪的行为。我正在尝试渲染一个名为的对象的嵌套属性,descrizione并且可以正常工作!但是在控制台中,我收到了Vue的警告:
TypeError:无法读取未定义的属性“ descrizione”
这是我的代码:
的HTML
<div id="input-container">
{{modello.lineaGialla.descrizione}}
<input
class="styled-checkbox"
type="checkbox"
v-for="(servizio, index) in modello.lineaGialla.servizi"
v-bind:style="{left:servizio.x+'px',top:servizio.y+'px'}"
v-model="servizio.selected"
v-on:click="AddServizi(servizio.selected,servizio.nomeServizio)"
/>
<br/>
{{modello.lineaBlu.descrizione}}
<input
class=""
type="checkbox"
v-for="(servizio, index) in modello.lineaBlu.servizi"
v-model="servizio.selected"
v-on:click="AddServizi(servizio.selected,servizio.nomeServizio)"
/>
</div>
Run Code Online (Sandbox Code Playgroud)
JSON格式
{
"lineaGialla": {
"class":"gialla",
"selected": false,
"descrizione": "Questa è linea gialla",
"descrizione_breve":"descrizione breve gialla",
"descrizione_lunga":"descrizione lunga gialla",
"servizi": [
{"nomeServizio":"servizio_giallo1","descrizione":"qui desc <br/> breve","descrizione_lunga":"qui desc lunga","x":534,"y":83,"selected": false},
{"nomeServizio":"servizio_giallo2","descrizione":"qui desc <br/> breve","descrizione_lunga":"qui desc lunga","x":399,"y":259,"selected": false},
{"nomeServizio":"servizio_giallo3","descrizione":"qui desc <br/> breve","descrizione_lunga":"qui desc lunga","x":224,"y":262,"selected": false},
{"nomeServizio":"servizio_giallo4","descrizione":"qui desc <br/> breve","descrizione_lunga":"qui desc …Run Code Online (Sandbox Code Playgroud) 尝试以通常的方式声明变量时出现错误,如下所示:
Vue.directive('my-directive', {
varA: '',
inserted: function(el, binding, vnode){
this.varA = 'test'; // TypeError: Cannot set property
// 'varA ' of undefined
},
});
Run Code Online (Sandbox Code Playgroud)
类型错误:无法设置未定义的属性“varA”
你如何在 Vue 指令中声明变量?
我看到Vue组件和内联模板之间有奇怪的行为。
示例#1:内联模板
这正在按预期方式工作。vue组件按下面的示例#2不变,唯一的区别是我已将模板内容作为内联模板复制到了标签中。
参见:https : //jsfiddle.net/pobffmnv/
<div class="panel panel-primary">
<div class="panel-heading">Current Clients</div>
<table class="table table-hover">
<thead>
<tr>
<th>Client Name</th>
<th style="text-align: center;">No. Projects</th>
<th style="text-align: center;">Time (7 days)</th>
<th style="text-align: center;">Edit</th>
</tr>
</thead>
<tbody>
<clientlistitem inline-template>
<tr>
<td>Test</td>
<td style="text-align: center;">0</td>
<td style="text-align: center;">0</td>
<td style="text-align: center;">
<div class="btn-group btn-group-xs" role="group">
<button type="button" class="btn small btn-primary">Edit</button>
</div>
</td>
</tr>
</clientlistitem>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
范例2:非内联
以下是我的Vue模板。下面是更改代码以删除嵌入式模板。
参见:https : //jsfiddle.net/Ld47hoy2/
<template>
<tr>
<td>Test</td>
<td style="text-align: center;">0</td>
<td …Run Code Online (Sandbox Code Playgroud) 基本上,我需要的是一个计算属性,当窗口内部宽度等于或低于768px时返回true,当它高于768px时返回false.
我做了什么:
computed: {
isMobile() {
if (window.innerWidth <= 768) {
return true
} return false
}
}
Run Code Online (Sandbox Code Playgroud)
但是只计算一次该属性,如果我稍后调整窗口大小,它不会对该更改做出反应,我该怎么办?
vue.js ×7
vuejs2 ×6
javascript ×3
sql ×2
sql-server ×2
ajax ×1
android ×1
c# ×1
json ×1
triggers ×1