main.js
export const app = new Vue() .....
axios
import {app} from '....main.js'
...
app.$tips ....
...確實,點開可以彈出Alert,但是存在執(zhí)行Js不一定就可以拿到cookie,比如HTTP-only
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<canvas></canvas>
<script>
window.onload = function () {
const canvas = document.getElementsByTagName('canvas')[0]
const ctx = canvas.getContext("2d");
const w = document.documentElement.clientWidth;
const h = document.documentElement.clientHeight;
canvas.width = w;
canvas.height = h;
let mols = []
function init() {
let mol = new generate_mol(1)
mols.push(mol);
}
function draw(){
canvas.width = canvas.width;
for(var i=0;i<mols.length;i++){
var m = mols[i];
m.draw();
}
}
function generate_mol(mol) {
this.x = w*0.3;
this.y = h*0.3;
// this.vx = Math.random()*-2;
// this.vy = Math.random()*2;
// this.vr = 0.1;
this.r = Math.random()*Math.PI;
this.draw = function() {
// ctx.save();
// ctx.translate(this.x + 20, this.y + 80);
// ctx.rotate(Math.PI * 0.17);
// ctx.translate(-this.x + 20, -this.y - 80);
// ctx.beginPath();
// ctx.moveTo(this.x, this.y + 30);
// ctx.lineTo(this.x - 26, this.y + 45);
// ctx.lineTo(this.x - 26, this.y + 75);
// ctx.lineTo(this.x, this.y + 90);
// ctx.lineTo(this.x + 26, this.y + 75);
// ctx.lineTo(this.x + 26, this.y + 45);
// ctx.lineTo(this.x, this.y + 30);
// ctx.moveTo(this.x - 20, this.y + 47);
// ctx.strokeStyle = "rgba(0,0,0,0.2)";
// ctx.lineWidth = 3;
// ctx.stroke();
// ctx.closePath();
// ctx.restore()
ctx.fillStyle = "rgba(0,0,0,0.5)";
ctx.font = "15px Arial";
ctx.fillText("A", this.x+40 , this.y+80);
ctx.save();
ctx.translate(this.x + 20, this.y + 30);
ctx.rotate(Math.PI * 0.17);
ctx.translate(-this.x + 20, -this.y - 80);
ctx.beginPath();
ctx.moveTo(this.x, this.y + 30);
ctx.lineTo(this.x - 26, this.y + 45);
ctx.lineTo(this.x - 26, this.y + 75);
ctx.lineTo(this.x, this.y + 90);
ctx.lineTo(this.x + 26, this.y + 75);
ctx.lineTo(this.x + 26, this.y + 45);
ctx.lineTo(this.x, this.y + 30);
ctx.moveTo(this.x - 20, this.y + 47);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.fillStyle = "rgba(0,0,0,0.5)";
ctx.font = "15px Arial";
ctx.fillText("B", this.x , this.y+70);
ctx.closePath();
ctx.restore()
ctx.save();
ctx.translate(this.x + 68, this.y + 56);
ctx.rotate(Math.PI * 0.17);
ctx.translate(-this.x + 20, -this.y - 80);
ctx.beginPath();
ctx.moveTo(this.x, this.y + 30);
ctx.lineTo(this.x - 26, this.y + 45);
ctx.lineTo(this.x - 26, this.y + 75);
ctx.lineTo(this.x, this.y + 90);
ctx.lineTo(this.x + 26, this.y + 75);
ctx.lineTo(this.x + 26, this.y + 45);
ctx.lineTo(this.x, this.y + 30);
ctx.moveTo(this.x - 20, this.y + 47);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.closePath();
ctx.restore()
ctx.save();
ctx.translate(this.x + 66, this.y + 110);
ctx.rotate(Math.PI * 0.17);
ctx.translate(-this.x + 20, -this.y - 80);
ctx.beginPath();
ctx.moveTo(this.x, this.y + 30);
ctx.lineTo(this.x - 26, this.y + 45);
ctx.lineTo(this.x - 26, this.y + 75);
ctx.lineTo(this.x, this.y + 90);
ctx.lineTo(this.x + 26, this.y + 75);
ctx.lineTo(this.x + 26, this.y + 45);
ctx.lineTo(this.x, this.y + 30);
ctx.moveTo(this.x - 20, this.y + 47);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.closePath();
ctx.restore()
ctx.save();
ctx.translate(this.x + 20, this.y + 135);
ctx.rotate(Math.PI * 0.17);
ctx.translate(-this.x + 20, -this.y - 80);
ctx.beginPath();
ctx.moveTo(this.x, this.y + 30);
ctx.lineTo(this.x - 26, this.y + 45);
ctx.lineTo(this.x - 26, this.y + 75);
ctx.lineTo(this.x, this.y + 90);
ctx.lineTo(this.x + 26, this.y + 75);
ctx.lineTo(this.x + 26, this.y + 45);
ctx.lineTo(this.x, this.y + 30);
ctx.moveTo(this.x - 20, this.y + 47);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.closePath();
ctx.restore()
//
ctx.save();
ctx.translate(this.x -27,this.y + 108);
ctx.rotate(Math.PI * 0.17);
ctx.translate(-this.x + 20, -this.y - 80);
ctx.beginPath();
ctx.moveTo(this.x, this.y + 30);
ctx.lineTo(this.x - 26, this.y + 45);
ctx.lineTo(this.x - 26, this.y + 75);
ctx.lineTo(this.x, this.y + 90);
ctx.lineTo(this.x + 26, this.y + 75);
ctx.lineTo(this.x + 26, this.y + 45);
ctx.lineTo(this.x, this.y + 30);
ctx.moveTo(this.x - 20, this.y + 47);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.closePath();
ctx.restore()
ctx.save();
ctx.translate(this.x -26, this.y + 56);
ctx.rotate(Math.PI * 0.17);
ctx.translate(-this.x + 20, -this.y - 80);
ctx.beginPath();
ctx.moveTo(this.x, this.y + 30);
ctx.lineTo(this.x - 26, this.y + 45);
ctx.lineTo(this.x - 26, this.y + 75);
ctx.lineTo(this.x, this.y + 90);
ctx.lineTo(this.x + 26, this.y + 75);
ctx.lineTo(this.x + 26, this.y + 45);
ctx.lineTo(this.x, this.y + 30);
ctx.moveTo(this.x - 20, this.y + 47);
ctx.strokeStyle = "rgba(0,0,0,0.2)";
ctx.lineWidth = 3;
ctx.stroke();
ctx.closePath();
ctx.restore()
}
}
init()
draw()
}
</script>
</body>
</html>
沒畫好 畫偏了
應(yīng)該還要加算法 來生成指定個數(shù)的
預(yù)覽地址
先說原因:map方法遍歷數(shù)組導(dǎo)致this.p被不斷的重新賦值,所以最后在componentDidMount中拿到的永遠都是數(shù)組最后一次遍歷創(chuàng)建的dom節(jié)點。
提供解法:
export default class Content extends Component{
componentDidMount() {
console.log(this.p0);
console.log(this.p1);
console.log(this.p2);
}
render() {
const arr = [{content:'內(nèi)容一'},{content:'內(nèi)容二'},{content:'內(nèi)容三'}];
const domP = arr.map((item,i) => {
return <p ref={(dom) => this['p' + i] = dom} key={i}>{item.content}</p>
});
retuen (
<div>
{domP}
</div>
);
}
}你是要再循環(huán)渲染el-switch么? 如果是,確保up.value是對象或者是數(shù)組再次v-for就好。參考一下
<ul class="HRcertifyUl_out" v-for="(item,index) in certifyList" :key="index">
<li class="HRcertifyLi_out" v-for="(itemL2,indexL2) in item.innerList2" :class="{active:itemL2.active}" :key="indexL2">
<div class="HRoutTopArea" @click="listOutClick(item,itemL2)">
<div class="HRoutBorderDiv">
<div class="HRoutIcon">
<Icon :type="itemL2.leftIcon" size="48"></Icon>
</div>
<div class="HRoutText">
<p class="cnText">{{itemL2.tittle}}</p>
</div>
<div class="HRoutArrowIcon">
<Icon :type="itemL2.active?itemL2.rightIconActive:itemL2.rightIcon"></Icon>
</div>
</div>
</div>
<div class="HRoutBottomArea">
<ul class="HRcertifyUl_in">
<li
class="HRcertifyLi_in"
:class="{active:itemL3.active}"
v-for="(itemL3,indexL3) in itemL2.list3"
:key="indexL3"
v-touch-ripple
@click="listInClick(itemL3,indexL3);">
{{itemL3.name}}
</li>
</ul>
</div>
</li>
</ul>(1)你在切換導(dǎo)航的時候給個類型區(qū)別,你可以在url添加一個錨點,例如http://localhost:8086/topic/index?nav=XXX.(XXX就是點擊nav名字)
(2)
<ul>
<li data-type=“wangye”>網(wǎng)頁</li>
<li data-type=“xinwen”>新聞</li>
<li data-type=“tieba”>貼吧</li>
</ul>
(3)用jquery或者js或者angularjs里自帶的路由獲取url里的XXX,讓li里的data-type值與XXX相等的添加高亮狀態(tài)。當然你也可以不用data-type,用id也可以。例如:
<ul>
<li id=“wangye”>網(wǎng)頁</li>
<li id=“xinwen”>新聞</li>
<li id=“tieba”>貼吧</li>
</ul>
$(XXX).addClass(高亮class);把XXX當id即可;
(4)好處:頁面刷新,選中的高亮狀態(tài)也不會消失,到達預(yù)期效果。 壞處:代碼不夠優(yōu)美,有待優(yōu)化與改善
text-align: center的意思是使該元素內(nèi)部的行內(nèi)元素居中。
而img一種特殊的行內(nèi)元素,我們暫且將其視為行內(nèi)元素。這樣,設(shè)置div為center即設(shè)置了圖片在容器中居中。
就像文字在h標簽中居中一樣。
可以嘗試用下面這個,也可以自己找一個
https://www.npmjs.com/package...
pyspider 會自動去重,抓過的連接不會重新抓取,引用大神的:https://segmentfault.com/q/10...
pyspider說明手冊
http://docs.pyspider.org/en/l...
我改成這樣就好了:
class Handler(BaseHandler):
crawl_config = {
'itag': 'v223'
}
只需要設(shè)置不認識的標簽不進行提示即可
在你的頁面body后面插入
<script src="https://cdn.socket.io/socket.io-1.0.0.js"></script>
之后就是正常的socketio使用了,
var socket = io('http://localhost');
socket.on('connect', function(){
socket.on('event', function(data){});
socket.on('disconnect', function(){});我是存在localstorage里,然后進入最外層的路由時判斷:
let routes = [{
path: '/login',
component: Login,
name: 'login'
},{
path: '/admin',
component: Admin,
beforeEnter: (to, from, next) => {
if(!localStorage.ACCOUNT || localStorage.ACCOUNT == ''){
next({
name: 'login'
})
}else{
next()
}
}
}]上redux,把checkbox的狀態(tài)保存在redux中
后端不是一樣可以拿到數(shù)據(jù)嗎
是沒問題啊,你跟后端商量好就行。
mapMutations的寫法不對。
把navTabs寫到[]里面,再試試。
你在module、route、myController中分別定義了一個myApp的模塊,但是他們之間并沒有關(guān)聯(lián)~
var app = angular.module('myApp', [ui.router]); // 定義app模塊
app.config(['$stateProvider', function(){}]) // 為app模塊注冊路由
dispatch是異步,commit是同步,沒找到數(shù)據(jù)就會報錯
北大青鳥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)師。