你應(yīng)該在服務(wù)端分頁,而不是在客戶端分頁
this.$echarts這個你哪來的
估計需要重啟一下。。。
axios是異步請求,在它外面且在下面的代碼不會等待它完成,會直接開始運行,而異步請求體里面的內(nèi)容會在其請求成功或者失敗才執(zhí)行相應(yīng)的代碼。
想在當(dāng)前頁面(xx.html)內(nèi)保存數(shù)據(jù)用vuex。
問題一和二都是這個答案。
同時,你緩存紅框部分的意義是什么呢?它的數(shù)據(jù)和狀態(tài)都是依附與當(dāng)前組件的,當(dāng)前組件銷毀了它的數(shù)據(jù)和狀態(tài)也沒了。
https://blog.csdn.net/wzygis/...
function htmlEncode(value){
return $('<div>').text(value).html();
}用你想用的 brackets 或者 phpstorm 編輯代碼,同時打開小程序開發(fā)工具來預(yù)覽不就好了- -
沒用過mogo , 但是 這個 MongoClient.connect 方法是不是異步的?
最起碼 應(yīng)該這樣。
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var dbo = db.db("runoob");
dbo.collection("site").find({}).toArray(function(err, resu) { // 返回集合中所有數(shù)據(jù)
if (err) throw err;
result.data.datalist.push(resu[0]);
db.close();
next()
});
}, function(req, res, next) {
res.send(result);
}));
你是否拒絕了授權(quán)?
直接把在css拿出來放在文件夾,比如放在中assets/css中,在main.js中,直接import './assets/css/loaders.css.css'就好了
url上加一個參數(shù)作為區(qū)分,比如:type:0 // 1表示從外面進來的,2表示表單添加上去的
兩個參數(shù)就可以分離了 index值區(qū)分一下
數(shù)據(jù)請求不到,接口返回是啥?dataList打印一下嘛,看看里面具體是啥
我underscore不太熟
你試試這樣行不行。
var templateTable2 = '<% _.each(dataList, function(n){ %>\
<tbody><tr data-id="<%=n.id %>">\
<th scope="row">\
<input type="checkbox" id="<%=n.id %>"</th>\
<td><%=n.local %></td>\
<td><%=n.upper %></td>\
</tr></tbody><% });%>';
var data= [{ id: 101,
local:'聯(lián)通',
upper:'北京教育網(wǎng)'
}, {
id: 102,
local:'電信',
upper:'北京教育網(wǎng)'
}];
var tpl = _.template(templateTable2)({ dataList:data });
console.log(tpl);myNumber.add(1)得到helper函數(shù),helper(i)就是window.helper(i),所以this指向window
node-static
npm i -g node-static
static --help
USAGE: /Users/svpg/.config/yarn/global/node_modules/.bin/static [-p <port>] [<directory>]
simple, rfc 2616 compliant file streaming module for node
Options:
--port, -p TCP port at which the files will be served [default: 8080]
--host-address, -a the local network interface at which to listen [default: "127.0.0.1"]
--cache, -c "Cache-Control" header setting, defaults to 3600
--version, -v node-static version
--headers, -H additional headers (in JSON format)
--header-file, -f JSON file of additional headers
--gzip, -z enable compression (tries to serve file of same name plus '.gz')
--spa serve the content as a single page app by redirecting all non-file requests to the index html file
--indexFile, -i specify a custom index file when serving up directories [default: "index.html"]
--help, -h display this help message
使用:
# 監(jiān)聽所有網(wǎng)卡的9999端口
static -p 9999 -a 0.0.0.0html:
<el-tree
:props="props"
:load="loadNode"
node-key="id"
ref="tree"
highlight-current
lazy
show-checkbox
@node-click="handleNodeClick">
</el-tree>
data:
props: {
label: 'indexName',
children: [],
isLeaf: 'leaf'
}
js:
// 異步樹節(jié)點點擊事件
handleNodeClick (data) {
console.log('node', data)
},
// 異步樹葉子節(jié)點懶加載邏輯
loadNode (node, resolve) {
// console.log(node, resolve)
// 一級節(jié)點處理
if (node.level === 0) {
this.requestTree(resolve)
}
// 其余節(jié)點處理
if (node.level >= 1) {
// 注意!把resolve傳到你自己的異步中去
this.getIndex(node, resolve)
}
},
// 異步加載葉子節(jié)點數(shù)據(jù)函數(shù)
getIndex (node, resolve) {
this.$AxiosAjax({
loading: true,
url: API_BASICQUOTA.getCatalogInfoByLevel,
params: {id: node.data.id, level: node.data.level + 1 + '', type: 'all'}
}).then(res => {
if (res.data.code === '200') {
// 處理節(jié)點是否是葉子節(jié)點
res.data.catalogInfo.forEach(et => {
if (et.isIndex === '1') {
et.leaf = true
} else {
et.leaf = false
}
})
let data = res.data.catalogInfo
console.log(data)
resolve(data)
}
})
},
// 首次加載一級節(jié)點數(shù)據(jù)函數(shù)
requestTree (resolve) {
this.$AxiosAjax({
loading: true,
url: API_BASICQUOTA.getCatalogInfoByLevel,
params: {id: '', level: '1', type: 'all'}
}).then(res => {
if (res.data.code === '200') {
// 處理節(jié)點是否是葉子節(jié)點
res.data.catalogInfo.forEach(et => {
if (et.isIndex === '1') {
et.leaf = true
} else {
et.leaf = false
}
})
let data = res.data.catalogInfo
resolve(data)
}
})
}八皇后問題
給你個參考,js的實現(xiàn)
const NUM_QUEENS = 8;
let solutionNum = 0;
let queens = (new Array(NUM_QUEENS)).fill(-1);
function eightQueensPuzzle(queens) {
placeQueen(queens, 0);
console.log(`解個數(shù)為${solutionNum}`);
}
function placeQueen(queens, row) {
for(let i = 0; i < NUM_QUEENS; i++) {
queens[row] = i;
if(row == 0) {
placeQueen(queens, row + 1);
} else {
if(isLegal(queens, row)) {
if(row == NUM_QUEENS - 1) {
solutionNum++;
console.log(queens);
} else {
placeQueen(queens, row + 1);
}
}
}
}
}
function isLegal(queens, row) {
for(let i = 0; i < row; i++) {
if(queens[row] == queens[i] || ( Math.abs(queens[row] - queens[i]) == Math.abs(row - i) )) {
return false;
}
}
return true;
}
eightQueensPuzzle(queens);
await next()和鏈式操作
比如:
// controllers/test.js
async function get (ctx, next) {
const res = await models.test.get()
ctx.state.code = 0
ctx.state.data = res.data
await next()
}
module.exports = get
import controllers from '../controllers/test'
admin.get('/category', controllers.test, async(ctx) => {
await ctx.render('admin/category', {
list: ctx.state.data
});
})async/await了解一下,這個寫法看起來挺像同步的。遇到異步的地方會堵塞,一直到異步方法執(zhí)行完成才會繼續(xù)往下執(zhí)行,達到類似同步執(zhí)行的效果。
用法很簡單,百度幾個例子看一下就明白了
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達內(nèi)教育集團成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎ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)辦藍懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負責(zé)iOS教學(xué)及管理工作。
浪潮集團項目經(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)師。