我正在尝试使用vue js并进行捆绑。当试图捆绑我的css和js文件时,正在使用vue插件进行汇总Select Case
,并添加了这样的配置,
Option Explicit
Public Sub GetInfo()
Dim html As New MSHTML.HTMLDocument, ws As Worksheet
Application.ScreenUpdating = False
Set ws = ThisWorkbook.Worksheets("Sheet2") '<== Must be sheet name where named ranges are
Dim searchString As String, URL As String
searchString = Replace$(LCase$(ws.Range("B3")), Chr$(32), Chr$(45)) & Chr$(45) & LCase$(ws.Range("B4")) 'Santa Ana in B3, CA in B4
URL = "https://www.zillow.com/" & searchString & "/home-values/"
html.body.innerHTML = GetHTML(URL)
Dim aNodeList As Object, i As Long
Set aNodeList = html.querySelectorAll(".value")
With ws
For i = 0 To aNodeList.Length - 1
Select Case i
Case 0 ' ZHVI
.Range("Market_Price") = aNodeList.item(i).innerText
Case 1 ' 1-yr forecast
.Range("yr_forecast") = aNodeList.item(i).innerText
Case 2 'Median listing price
.Range("Median_List_Price") = aNodeList.item(i).innerText
Case 3 'Median sale price
.Range("Median_Sale_Price") = aNodeList.item(i).innerText
Case 4 'Market Health Index
.Range("Healthy") = aNodeList.item(i).innerText
Case 5 'Homes with negative equity
.Range("Home_With_Negative_Equity") = aNodeList.item(i).innerText
Case 6 'Delinquent on mortgage
.Range("Delinquent_On_Mortgage") = aNodeList.item(i).innerText
Case 7 'Median list price / sq ft
Case 8 'Median sale price / sq ft
Case 9
Case 10 'Value Listings with price cut
.Range("Price_Cut") = aNodeList.item(i).innerText
Case 11 'Breakeven horizon
.Range("Breakeven") = aNodeList.item(i).innerText
Case 12
.Range("Rent_List_Price") = aNodeList.item(i).innerText ' Rent list price
Case 13 'List price / sq ft
.Range("Rent_sq") = aNodeList.item(i).innerText
End Select
Next i
URL = "https://datausa.io/profile/geo/" & searchString
html.body.innerHTML = GetHTML(URL)
ThisWorkbook.Worksheets("Engine").Range("Population") = html.querySelector(".stat-value").innerText
End With
Application.ScreenUpdating = True
End Sub
Public Function GetHTML(ByVal URL As String) As String
Dim sResponse As String
With CreateObject("MSXML2.XMLHTTP")
.Open "GET", URL, False
.send
sResponse = StrConv(.responseBody, vbUnicode)
End With
GetHTML = Mid$(sResponse, InStr(1, sResponse, "<!DOCTYPE "))
End Function
我的问题是,当捆绑文件时,css文件会在每行添加新行
rollup-plugin-vue
帮我摆脱CSS的换行符
编辑:
vue({
compileTemplate: true,
css:true
}),
答案 0 :(得分:-1)
document.querySelector('br').remove();
<div>
Lorem Ipsum dolor set amet
</div>
<br>
<div >
Lorem Ipsum dolor set amet
</div><br>
您可以使用简单的脚本删除不必要的标签。 限制它们在父元素中使用,以不影响其他区域。