可以嘗試<keep-alive>進(jìn)行緩存,或者后退到B時(shí)重新渲染B里的數(shù)據(jù)
toggleClass的用法就是,如果你選擇的頁面元素中存在class屬性,那就去掉calss屬性;如果不存在class屬性,就添加class屬性。
<a class="glyphicon glyphicon-chevron-down" id="row"></a>
$("#row").click(function(){
$(this).toggleClass('glyphicon glyphicon-chevron-up');
})
點(diǎn)擊一次的時(shí)候,代碼去掉 ‘glyphicon’ 加上 ‘glyphicon-chevron-up’
代碼變成了
<a class="glyphicon-chevron-down glyphicon-chevron-up" id="row"></a>
所以圖標(biāo)顯示不出來
要想實(shí)現(xiàn)切換可以改成
$("#row").click(function(){
$(this).toggleClass('glyphicon-chevron-down glyphicon-chevron-up');
})
echo $PS1
得出結(jié)果:
[033[01;32m]u@h[033[00m]:[033[01;36m]w[033[00m]$【空格】【空格】【空格】 【空格】
我查看一下PS1這個(gè)值,把整個(gè)復(fù)制下來檢車一遍,最后發(fā)現(xiàn)PS1這個(gè)值尾部多個(gè)幾個(gè)空格,去掉即可。
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;36m\]\w\[\033[00m\]\$"簡(jiǎn)寫方式只是針對(duì) fn(){} => fn: function() {}你寫方式引擎不認(rèn)識(shí)
skip32
使用BigDecimal類來進(jìn)行計(jì)算
不是有個(gè)v-model么
你在你的gulpfile文件里面把你的引入代碼壓縮的gulp插件和生成hash值的gulp插件的代碼注釋掉重新運(yùn)行g(shù)ulp就行了
不透明度為1不會(huì)有什么動(dòng)畫吧,而且點(diǎn)擊事件控制show的變化寫了么
額,是我問題沒提好。運(yùn)行結(jié)果沒有報(bào)錯(cuò),所以這個(gè)不好改,我把所有代碼都檢查了n遍,最后我認(rèn)為,是因?yàn)槎拱陼?huì),這是我的猜測(cè)也不知道對(duì)不對(duì),會(huì)設(shè)定如果頻繁發(fā)出post請(qǐng)求會(huì)鎖定IP,cookie,然后你就沒辦法再操作,因?yàn)檫@個(gè)有時(shí)可以,有時(shí)又不行。
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腳本無效。
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腳本無效
設(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è)文檔的解析來講,指的腳本的開始加載的時(shí)間點(diǎn)。
async 異步執(zhí)行,具體什么時(shí)間點(diǎn)執(zhí)行由瀏覽器決定,具體的時(shí)間點(diǎn)不確定,但是確定會(huì)去加載執(zhí)行,設(shè)置了async的各個(gè)腳本加載執(zhí)行完畢的時(shí)間和它們放置插入的順序沒有確定的關(guān)系。和DOMContentLoaded事件發(fā)生也沒有確定的前后關(guān)系,可能在DOMContentLoaded事件前某個(gè)async腳本執(zhí)行完了,也有可能async腳本一個(gè)都沒有執(zhí)行。async指的是文檔的加載方式,同步的還是異步的,并不指定什么時(shí)候開始加載。一般都會(huì)處理成在DOMContentLoaded事件發(fā)生后,就相當(dāng)于這些腳本是通過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我已用其他方法解決 。找了很久,想了很久,貌似不能直接在驗(yàn)證里面做轉(zhuǎn)化,但是我想到了一個(gè)更好的解決辦法,解決方法如下 :
Laravel 有中間件,我們通常在中間件中做一些過濾 HTTP 請(qǐng)求的操作,但是還能做很多“請(qǐng)求預(yù)處理”操作,如 Laravel 內(nèi)置的 TrimStrings 中間件 和 ConvertEmptyStringsToNull 中間件 ,這兩個(gè)中間件都會(huì)把請(qǐng)求來的參數(shù)做些預(yù)處理操作,具體的使用請(qǐng)看源碼 。
所以 , 我的解決方法就是創(chuàng)建一個(gè) ConvertNumericStringsToInt 中間件 :
class ConvertNumericStringsToInt extends TransformsRequest
{
/**
* The attributes that should not be trimmed.
*
* @var array
*/
protected $except = [
//
];
/**
* Transform the given value.
*
* @param string $key
* @param mixed $value
* @return mixed
*/
protected function transform($key, $value)
{
$transform = false;
if ($key === 'id') {
// 參數(shù)為 id
$transform = true;
} else if (1 === preg_match('/^[a-zA-Z][0-9a-zA-Z]*_id$/', $key)) {
// 參數(shù)為 *_id
$transform = true;
} else if (1 === preg_match('/^[a-zA-Z][0-9a-zA-Z]*Id$/', $key)) {
// 參數(shù)為 *Id
$transform = true;
}
if ($transform) {
if (!is_numeric($value)) {
// 做你自己想做的處理( 如拋出異常 )
}
return is_numeric($value) ? intval($value) : $value;
}
// 返回原值
return $value;
}
}
這樣,只要我們的傳來的參數(shù)是 id , 或者 _id( user_id ),或者 Id( 如userId ),這個(gè)中間件都能檢測(cè),一旦發(fā)現(xiàn)不是數(shù)字 , 就會(huì)被處理( 如拋出異常 ),如果是數(shù)字的話,會(huì)被強(qiáng)轉(zhuǎn)為int類型,我們之后的程序中就不用做任何處理了。
根據(jù)自己的使用情況決定是否將此中間件應(yīng)用都全局中 。
鼓搗半天,現(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)無法找到的問題
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'
}
}
HTML5 中的 button 里可以放圖像,看手機(jī)是否支持 HTML5
不是代碼問題 可以問問運(yùn)維 這和網(wǎng)絡(luò)有關(guān)系
form 表單需要阻止提交按鈕的默認(rèn)行為
沒有仔細(xì)看代碼,解決方案:
input.on('keypress',function(event) {.....
把on前面加個(gè)解綁事件
input.off().on('keypress',function(event) {.....
可能有事件外面有循環(huán),先把事件解綁,在進(jìn)行添加就可以了,請(qǐng)采納
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(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)開發(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ū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問,美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。