先說個我的結(jié)論,在使用 ESM 模塊化語法的情況下關(guān)不了,當(dāng)然結(jié)論可能是片面的。
原來碰到過 callee 嚴(yán)格模式不存在的問題,經(jīng)過我使用 loader,plugin 等均無法拿到添加 use strict 字符串的具體時機(jī),然后我就放棄了,transform-remove-strict-mode 也試過無效。
但是有一種方式可以不被添加 use strict 字符串,那就是在你需要使用 "嚴(yán)格模式禁用語法" 的這個 js 文件里不要使用 ESM(import export),而是使用 commonjs 模塊語法,即 require 和 module/export。ESM 規(guī)范中有一條是說使用 ESM 規(guī)范語法會自動進(jìn)入嚴(yán)格模式,所以不確定這個 use strict 是不是 node 加上的,而不是 webpack/babel 的效果。
babel可以配置env
{
"env": {
"test": {
"presets": ["env"]
},
"production": {
"presets": [
["env",
{
"modules": false
}]
]
}
},
"ignore": [
"dist/*.js"
]
}
然后,可以在npm scripts里配置BABEL_ENV
"scripts": {
"test": "cross-env BABEL_ENV='test' jest --watchAll --coverage",
"prettier": "prettier --write --no-semi {.,test}/*.js",
"build": "cross-env BABEL_ENV='production' rollup -c"
}這不是很清楚了嗎? @storybook/react升級到4.x
'/api' 改成 '/v1', pathRewrite刪除
已經(jīng)涼了這個問題?
你還有用了其他全局的中間件嗎?
<RadioGroup @on-change="handleChange()" v-if="item.questionType == '單選題'" v-model="answerInfo[index].singlechoice_default" vertical>
</RadioGroup>
method里面handleChange(val)取val
<navigator/>沒加url
p 標(biāo)簽是不允許嵌入 p 標(biāo)簽內(nèi).
所以你的嵌入層級的 p 在瀏覽器看來是這樣的.
<p> // 第一個 p
<p> // 自動為第一個 p 補(bǔ)全關(guān)閉標(biāo)簽, 開始第二個 p
<p> // 自動為第二個 p 補(bǔ)全關(guān)閉標(biāo)簽, 開始第三個 p
</p> // 第三個 p 結(jié)束
</p> // 第四個 p 開始, 為其補(bǔ)充開始標(biāo)簽
</p> // 第五個 p 開始, 為其補(bǔ)充開始標(biāo)簽
結(jié)果就是:
<p></p> // 只有這個滿足 p:first-child
<p></p>
<p></p>
<p></p>
<p></p>在以往windows ie為主的時代,可以通過檢查控件等方式判斷,但現(xiàn)在H5,都不建議用控件了,所以需要別的方法了。
一般是用特殊協(xié)議檢測法,不過囿于瀏覽器安全控制方面的原因,效果不會完美。
問題原因是使用事務(wù)時,缺少 rollback 或 commit,使用以下代碼可穩(wěn)定復(fù)現(xiàn)這個錯誤:
let mysql = require("mysql");
function createConn() {
return mysql.createConnection({
host : '192.168.1.100',
user : 'yangqiang',
password : '123456',
database : 'node_mysql_demo'
});
}
function transactionWithoutCommit(conn) {
conn.beginTransaction(function (err) {
if (err) {
throw err;
}
conn.query('SELECT * from user where name="jonny"', function (error, results, fields) {
if (error) {
return conn.rollback(function () {
throw error;
})
} else {
// 缺少 commit,引發(fā)錯誤
}
});
});
}
function transactionWithCommit(conn) {
conn.beginTransaction(function (err) {
if (err) {
throw err;
}
conn.query('SELECT * from user where name="jonny"', function (error, results, fields) {
if (error) {
return conn.rollback(function () {
throw error;
})
} else {
conn.commit(function (err) {
if (err) {
return conn.rollback(function(){ throw err;})
} else {
console.log('transaction committed');
}
});
}
});
});
}
function write(conn) {
conn.query('INSERT INTO user (name) VALUES ("Mei");', function (error, results, fields) {
if (error) throw error;
console.log(JSON.stringify(results));
});
}
var connection = createConn();
connection.connect();
transactionWithoutCommit(connection); // 引發(fā)錯誤
// transactionWithCommit(connection); // 正確的方法
write(connection);this.callback 做回調(diào),不傳參數(shù)能拿得到 response ???
已修正 數(shù)字也轉(zhuǎn)正了
附上https://codepen.io/wanroulin/... 供參考
主要修改的片段為內(nèi)圈旋轉(zhuǎn)角度 及 數(shù)字校正角度
// scale
ctx.setTransform(1, 0, 0, 1, Math.floor(W / 2), Math.floor(W / 2));
ctx.beginPath();
ctx.lineWidth = 2;
ctx.strokeStyle = 'rgba(255, 255, 255, .3)';
// there should be 10 lines
var stepAngle = (Math.PI * 2) / 10;
// begin angle
ctx.rotate(0.7 * Math.PI);
// draw only 9 of the 10 lines
for (var i = 0; i < 9; i++) {
ctx.moveTo(Math.floor(W / 3) - 50, 0);
ctx.lineTo(Math.floor(W / 3) - 55, 0);
ctx.rotate(stepAngle);
}
ctx.stroke();
ctx.setTransform(1, 0, 0, 1, 0, 0);
// scale txt
ctx.fillStyle = 'rgba(255, 255, 255, .4)';
ctx.font = "1.5vh play";
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
var stepAngle = (Math.PI * 2) / 10;
var currentAngle = 0.20 * Math.PI;
for (i = 0; i < 9; i++) {
// move to center, unrotated
ctx.setTransform(1, 0, 0, 1, Math.floor(W / 2), Math.floor(W / 2));
// set current rotation
ctx.rotate(currentAngle)
// move the context to our text's position
ctx.translate(0, Math.floor(W / 3) - 65);
// inverse rotate so we face North
ctx.rotate(-currentAngle);
// fill at 0,0
ctx.fillText(0 + 1 * i, 0, 0);
// increment currentAngle for next iteration
currentAngle += stepAngle;
}
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.restore();卸載相關(guān)插件
那你可以保存當(dāng)前選中的index值再一個隱藏input[id="selectIndex"]中,select選中時,存儲選中的index到改隱藏input中,然后提交時,直接通過index,設(shè)置
// 選中時的處理
document.querySelector("#selectIndex").value = 當(dāng)前選中的index的值;
let index = parseInt(document.querySelector("#selectIndex"));
items[index].score = changingScore;
或者存儲選中值到localStorage或sessionStorage中都可以,思路就是存儲、更新維護(hù)一個index值;
如果自己的服務(wù)器帶寬有限,放在自己服務(wù)器上時請求靜態(tài)資源也是很慢的??梢园鸯o態(tài)文件放到第三方對象存儲服務(wù)上統(tǒng)一管理。比如七牛云cdn,阿里云oss
data里綁定一個標(biāo)記:
data:{
visible: false
}
// 點擊的時候
this.visible改為ture,同時video.pause()
html內(nèi)用visible來顯示隱藏我試了一下,沒出現(xiàn)你說的這個情況。。。
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。