在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ HTML問答
絯孑氣 回答

export default withrouter(connect(({ menuData }) => ({
menuData
}))(HomeLayout));
創(chuàng)建時(shí)候 外層包 一個(gè) withrouter
可以解決

司令 回答

百度的document.write

clipboard.png

正常頁面的document.write

clipboard.png

百度自己覆蓋了document.write這個(gè)方法

夕顏 回答

如問題所示,存在兩個(gè)使用了webpack code-splitting 和 懶加載的路由文件,路由文件都使用了公用的public.js模塊。
// page/index/Index.vue 首頁路由文件

<template>首頁</template>
<script>
    import pub from 'script/public'
    ...
</script>

// 用戶頁
// page/index/Index.vue 用戶頁路由文件

<template>用戶頁</template>
<script>
    import pub from 'script/public'
    ...
</script>

要將 public.js公用模塊抽離,有兩種解決方案

方案一,CommonsChunkPlugin 具名模塊

手動(dòng)將所有共用的模塊抽離在一個(gè)文件。
創(chuàng)建文件commons.js

// commons.js
import pub from 'public'

webpack.config.jsCommonsChunkPlugin插件指定commons 的entry

// webpack.config.js
entry:{
    main: 'src/main.js',
    commons: 'src/commons.js'
},
...
    new webpack.optimize.CommonsChunkPlugin({
        name: "commons",   // 和 entry的commons對(duì)應(yīng),
        filename: 'common.bundle.js', // 抽離公共文件
        minChunks: Infinity,
    })

這樣,如果路由文件或其他模塊使用到了 commons.js中的模塊,都不會(huì)重復(fù)加載代碼,而是在common.bundle.js中獲取。

方案二,CommonsChunkPlugin 設(shè)置 children 屬性

官方文檔CommonsChunkPlugin 中 children屬性解釋

Move common modules into the parent chunk

With Code Splitting, multiple child chunks of an entry chunk can have common dependencies. To prevent duplication these can be moved into the parent. This reduces overall size, but does have a negative effect on the initial load time. If it is expected that users will need to download many sibling chunks, i.e. children of the entry chunk, then this should improve load time overall.

可知,設(shè)置 children 為 true 可以將code-splitting的模塊的依賴模塊抽離到父模塊,這樣做的后果就是,確實(shí)抽離公用模塊,降低了代碼重復(fù),減少了代碼體積。但是同時(shí),抽離到父模塊,也意味著如果有一個(gè)懶加載的路由 ShopList.vue 沒有用到public.js 模塊,但是實(shí)際上引入了父模塊,也為這ShopList.vue也引入了public.js的代碼。

這就需要CommonsChunkPluginasync 屬性。

方案三(最佳實(shí)踐),childrenasync 雙管齊下

Extra async commons chunk

Similar to the above one, but instead of moving common modules into the parent (which increases initial load time) a new async-loaded additional commons chunk is used. This is automatically downloaded in parallel when the additional chunk is downloaded.

設(shè)置了async, 會(huì)將上述懶加載的路由文件公用的模塊代碼,抽離打包成一個(gè)單獨(dú)的文件,并且該文件是按需加載的,如果某個(gè)路由沒有使用到這些公用模塊,是不會(huì)加載進(jìn)來的。

舉個(gè)例子:
首頁路由模塊(訪問路徑/index),引用了 public模塊
用戶路由模塊(訪問路徑/user),引用了 public模塊
購物車模塊(訪問路徑/shop),沒有引用 public模塊

那么,打包生成的文件大概是

main.js - 根入口文件
index.js - 首頁路由文件
user.js - 用戶路由文件
shop.js - 購物車路由文件
0.js - 抽離路由的公用模塊文件

訪問url/index,加載的依賴文件是main.js + index.js + 0.js
訪問url/user,加載的依賴文件是main.js + user.js + 0.js
訪問url/shop,加載的依賴文件是main.js + shop.js
基本解決了 lazy load + code-splitting 情況下的公用模塊抽離。

以下附上簡(jiǎn)單的webpack.config.js配置代碼

entry: {
    main: './src/main.js'
},
...
plugins: [
    ...
    new webpack.optimize.CommonsChunkPlugin({
        name: "main",
        minChunks: 2,
        children: true,
        // deepChildren: true,
        async: true,
    })
]

參考資料

commons-chunk-plugin
CommonChunkPlugin: Feature - Select statically imported modules from chunks that were created from a dynamic import (require.ensure / System.import / import(".."))

練命 回答

答案已經(jīng)找到了 是一個(gè)非常低級(jí)的錯(cuò)誤! 我在有瀏覽器前綴的js語句中少給了 ‘px’作為單位 造成 樣式無效!低級(jí)錯(cuò)誤 一定要避免!

尐懶貓 回答

是不是被autoprefix去掉了,看看webpack的配置

拮據(jù) 回答

可以試試這樣:

在父頁面 onShow 方法中設(shè)置數(shù)據(jù)刷新. 這樣當(dāng)wx.navigateBack()后就能觸發(fā)更新了.

尛憇藌 回答

<template>
<div>This will be pre-compiled</div>
</template>
<script src="./my-component.js"></script>
<style src="./my-component.css"></style>

喜歡你 回答

Webpack 只懂 JavaScript 。

file-loader 讓 Webpack 可以理解一些非 JavaScript 的資源,自動(dòng)生成(emit)文件到目標(biāo)文件夾(outputPath),然后返回項(xiàng)目運(yùn)行時(shí)用的地址(publicPath)。(也可以不生成文件,只為獲得地址,文件再自行處理)。目的是為了借用 Webpack 來一并處理文件依賴。

url-loader 功能跟 file-loader 一樣,只是可以對(duì)小的資源進(jìn)行 base64 編碼 URL 處理而不 emit 文件。

css-loader 是為了讓 Webpack 理解 CSS,只是把 url() 變成 import/require()。還需要上面兩個(gè) loader 來處理資源。

冷咖啡 回答

URLencoder.encode();
URLencoder.decode();

久愛她 回答

new name()這個(gè)是直接拿來用了 如果沒有name這個(gè)方法肯定報(bào)錯(cuò)
就相當(dāng)于 var str = a || "abc" 這里a根本就沒定義就會(huì)報(bào)錯(cuò)
但是,我試了一下用ie11模擬ie低版本,連ie5都有XMLHttpRequest這個(gè)東西,所以你這樣寫是不會(huì)報(bào)錯(cuò)的,永遠(yuǎn)走的是new XMLHttpRequest

心上人 回答

[^>]* 匹配非左尖括號(hào)的任意字符多次.

html tag 可以很長(zhǎng),比如:

<link rel="icon" sizes="any" mask  />
朕略傻 回答

在后臺(tái)設(shè)置允許這個(gè)當(dāng)前地址跨域。。。

不歸路 回答

1、其實(shí)不可點(diǎn)擊,就是一個(gè)用戶的感知,不代表事件一定不執(zhí)行。
2、你這個(gè)例子,可以在 changeSection 里面做邏輯嘛,在函數(shù)開始部分,當(dāng)達(dá)到你的禁用條件后,直接 return null; 就好了,這個(gè)函數(shù)就不執(zhí)行后面的邏輯了,對(duì)于用戶的感知來說,就是這個(gè)點(diǎn)擊無效;
3、當(dāng)然了,如果你非要用css來搞事情的話,那么還真有這個(gè)樣式:pointer-events: none;,設(shè)置后,就和鼠標(biāo)事件拜拜了,具體功效,你可以自行嘗試,如有疑問,歡迎Google。

刮刮樂 回答

后臺(tái)寫個(gè)接口,返回需要的數(shù)據(jù)。

野橘 回答

commonjs用commonchunkplugin打

吃藕丑 回答

首先是一個(gè)對(duì)象然后才是里面的data為數(shù)組 數(shù)據(jù)結(jié)構(gòu)看清楚一點(diǎn)啊

維她命 回答

<WrappedComponent { ...this.props } /> 你這里不用寫啊,WrappedComnponent 本身就會(huì)有props,無需傳遞的。你本來就是default props

逗婦乳 回答

其實(shí)我是后端開發(fā)者,但是前段一般也會(huì)做一些,我一般用Sublime Text的cssrem轉(zhuǎn)換插件
https://github.com/flashlizi/...

不知道這是不是你想要的答案