簡(jiǎn)寫(xiě)方式只是針對(duì) fn(){} => fn: function() {}你寫(xiě)方式引擎不認(rèn)識(shí)
不是有個(gè)v-model么
你在你的gulpfile文件里面把你的引入代碼壓縮的gulp插件和生成hash值的gulp插件的代碼注釋掉重新運(yùn)行g(shù)ulp就行了
不透明度為1不會(huì)有什么動(dòng)畫(huà)吧,而且點(diǎn)擊事件控制show的變化寫(xiě)了么
defer
This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded.
Scripts with the defer attribute will execute in the order in which they appear in the document.
此屬性對(duì)內(nèi)聯(lián)的JS腳本無(wú)效。
script的defer值的設(shè)置就是告訴瀏覽器,這個(gè)腳本將在DOM文件解析完成后DOMContentLoaded事件發(fā)生之前執(zhí)行。有defer屬性的script腳本按在HTML文件中出現(xiàn)的順序順序執(zhí)行。async HTML5
This is a Boolean attribute indicating that the browser should, if possible, execute the script asynchronously.
Dynamically inserted scripts execute asynchronously by default, so to turn on synchronous execution (i.e. scripts execute in the order they were inserted) set async=false.
此屬性對(duì)內(nèi)聯(lián)的JS腳本無(wú)效
設(shè)置async屬性就是告訴瀏覽器如果有可能就異步執(zhí)行指定的JS腳本,動(dòng)態(tài)插入的腳本默認(rèn)是異步加載執(zhí)行的,除非手動(dòng)設(shè)置async=false
defer 延遲執(zhí)行,但會(huì)在DOMContentLoaded事件發(fā)生之前執(zhí)行完畢,defer腳本會(huì)順序同步的執(zhí)行。defer延遲是相對(duì)于整個(gè)文檔的解析來(lái)講,指的腳本的開(kāi)始加載的時(shí)間點(diǎn)。
async 異步執(zhí)行,具體什么時(shí)間點(diǎn)執(zhí)行由瀏覽器決定,具體的時(shí)間點(diǎn)不確定,但是確定會(huì)去加載執(zhí)行,設(shè)置了async的各個(gè)腳本加載執(zhí)行完畢的時(shí)間和它們放置插入的順序沒(méi)有確定的關(guān)系。和DOMContentLoaded事件發(fā)生也沒(méi)有確定的前后關(guān)系,可能在DOMContentLoaded事件前某個(gè)async腳本執(zhí)行完了,也有可能async腳本一個(gè)都沒(méi)有執(zhí)行。async指的是文檔的加載方式,同步的還是異步的,并不指定什么時(shí)候開(kāi)始加載。一般都會(huì)處理成在DOMContentLoaded事件發(fā)生后,就相當(dāng)于這些腳本是通過(guò)JS腳本動(dòng)態(tài)添加的
normal.js
console.log("normal loaded js");
defer.js
console.log("defer loaded js");
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<script type="text/javascript" defer src="../js/defer.js"></script>
<script type="text/javascript" src="../js/normal.js"></script>
<title>Defer Script</title>
<script>
document.addEventListener("DOMContentLoaded", function(event) {
console.log("DOMContentLoaded");
});
</script>
</head>
<body>
</body>
</html>
輸出
normal loaded js
defer loaded js
DOMContentLoaded鼓搗半天,現(xiàn)在如下配置,能成功運(yùn)行。還在查資料ing
build/utils.js
...
function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
if (loader) {
loaders.push({
loader: loader + '-loader',
options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap
})
})
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
publicPath: '../../', // 解決css的字體圖標(biāo)無(wú)法找到的問(wèn)題
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
}
}
...
build/webpack.base.conf.js
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
var webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
app: './src/main.js',
},
plugins: [
new ExtractTextPlugin({filename: "main.css", allChunks: true}), //抽離成一個(gè)單獨(dú)的css
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"windows.jQuery": "jquery"
})
],
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'),
}
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: vueLoaderConfig
// options: {loaders:{
// css: ExtractTextPlugin.extract({
// use: 'css-loader',
// fallback: 'vue-style-loader'
// })
// }}
},
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('../src'), resolve('test')]
},
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('img/[name].[hash:7].[ext]')
}
},
{
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('media/[name].[hash:7].[ext]')
}
},
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
}
]
},
node: {
// prevent webpack from injecting useless setImmediate polyfill because Vue
// source contains it (although only uses it if it's native).
setImmediate: false,
// prevent webpack from injecting mocks to Node native modules
// that does not make sense for the client
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty'
}
}
!flag是取反,不是置反
flag=!flag;可以HTML5 中的 button 里可以放圖像,看手機(jī)是否支持 HTML5
不是代碼問(wèn)題 可以問(wèn)問(wèn)運(yùn)維 這和網(wǎng)絡(luò)有關(guān)系
form 表單需要阻止提交按鈕的默認(rèn)行為
沒(méi)有仔細(xì)看代碼,解決方案:
input.on('keypress',function(event) {.....
把on前面加個(gè)解綁事件
input.off().on('keypress',function(event) {.....
可能有事件外面有循環(huán),先把事件解綁,在進(jìn)行添加就可以了,請(qǐng)采納
d.ts文件就是作為你的一些復(fù)合類(lèi)型、類(lèi)、函數(shù) 其行為的約定。
用來(lái)告訴其他人,這個(gè)函數(shù)的簽名是什么,返回值是什么。
這個(gè)類(lèi)提供了什么方法,我可以拿它來(lái)做什么事情。
可以理解為是說(shuō)明書(shū)吧。
.vue文件準(zhǔn)確的說(shuō)是一個(gè)單文件組件,其中包括了template(html部分),script(vue腳本部分)和style(css/less樣式部分),所以單純的把.vue變成.js是不太合理的。單純的把里面的腳本部分拿出來(lái),可能也需要依賴一些其他的東西。
代碼都沒(méi)嗎.........
你操作最最好先判斷data的類(lèi)型 slice方法為undefined 說(shuō)明它不是個(gè)數(shù)組
或者你和后臺(tái)約定好 只要不是error 返回值都是數(shù)組
你用js獲取一下點(diǎn)擊事件,然后重寫(xiě)他,或者讓他失效吧
jquery移除、綁定、觸發(fā)元素事件使用示例詳解
str === 'true'
或者
str === 'true' ? true : str === 'false' ? false : '我也不知道是什么鬼'
北大青鳥(niǎo)APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專(zhuān)業(yè)的國(guó)家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
北大課工場(chǎng)是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國(guó)家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國(guó)制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級(jí)產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國(guó)職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開(kāi)發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_(kāi)發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開(kāi)發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開(kāi)發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開(kāi)發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問(wèn),美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。