我们有一个由bloodhoundjs提供支持的先行搜索。目前minlength设置为3.但我想知道是否可以根据字符串与数字动态更改minlength。因此,如果用户只键入输入中的数字,如果minlength值为1,则minlength值为1,则minlength值为3。
这里有一个小提琴,一切都设为3。如果输入只是数字,我希望它能动态地改为1.
https://jsfiddle.net/v5hk8r36/
Sub FormatBOMExport()
'
' FormatBOMExportPnV Macro
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False
' delete extra sheets
Sheets(Array("Sheet2", "Sheet3")).Select
ActiveWindow.SelectedSheets.Delete
WBPath = Application.ActiveWorkbook.Path
OrgFile = Application.ActiveWorkbook.FullName
Range("B1").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Columns("A:M").Select
Selection.Replace What:="" & Chr(10) & "", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Columns.AutoFit
Selection.Rows.AutoFit
Columns("J:J").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
' Columns("J:J").Select
' Columns("J:J").ColumnWidth = 100
' Selection.Rows.AutoFit
Columns("G:G").EntireColumn.AutoFit
Range("G2").Select
' Remove/Replace Invalid File Name Characters
WkbName = Range("H2")
MyArray = Array("<", ">", "|", "/", "*", "\", ".", "?", """")
For X = LBound(MyArray) To UBound(MyArray)
WkbName = Replace(WkbName, MyArray(X), "_", 1)
Next X
'MsgBox WkbName 'dispaly file name with illegal characters removed
ActiveWorkbook.SaveAs Filename:= _
WBPath & "\BOM_" & Range("G2") & "_" & WkbName & ".xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
If Len(Dir$(OrgFile)) > 0 Then
Kill OrgFile
End If
Application.DisplayAlerts = True
Application.ScreenUpdating = True
' MsgBox OrgFile & " has been deleted and saved as " & "BOM_" & Range("G2") & "_" & Range("H2") & ".xlsx"
End Sub
`
类似
const $tagsInput = $('#tagsInput')
$tagsInput.typeahead({
hint: true,
highlight: true,
minLength: 3
}, {
name: 'suggestions',
displayKey: 'value',
source: bloodhoundSuggestions
});