我需要实现一个按钮,该按钮将在我的应用程序中放置过滤器。该应用程序是在Vue上编写的。过滤器本身已实现,但我不知道如何实现其重置。
private readonly SqlConnection _con = new SqlConnection("Data Source=.;Initial
Catalog=dbPhoneBook;Integrated Security=True");
public string Add(string user , string pass)
{
string result = "";
SqlCommand cmd = new SqlCommand();
try
{
cmd.Connection = _con;
cmd.CommandText = "insert into tbl_login(user,pass)values(@user,@pass)";
cmd.Parameters.AddWithValue("@user", user);
cmd.Parameters.AddWithValue("@pass", pass);
if (_con.State != ConnectionState.Open)
{
_con.Open();
}
cmd.ExecuteNonQuery();
result = "Ok";
cmd.Dispose();
}
catch
{
cmd.Dispose();
result = "NOk";
}
return result;
}
答案 0 :(得分:1)
您将需要一个重置功能,该功能将为默认模型指定分配的值,例如:'none'到v模型'sort'。由于它是双向绑定,因此更改“ sort”变量的值最终将重置所选的选项。
要添加的功能:
resetOptions: function () {
this.sort='none';
}