当前位置: 首页 > news >正文

房地产网站怎么做怎么seo快速排名

房地产网站怎么做,怎么seo快速排名,卢湾企业微信网站制作,做付费推广哪个网站好vue之mustache库的机理其实是将模板字符串转化为tokens 然后再将 tokens 转化为 dom字符串&#xff0c;如下图 对于一般的将模板字符串转化为dom字符串&#xff0c;这样不能实现复杂的功能 let data {name:小王,age:18 } let templateStr <h1>我叫{{name}},我今年{{ag…

        vue之mustache库的机理其实是将模板字符串转化为tokens 然后再将 tokens 转化为 dom字符串,如下图

 对于一般的将模板字符串转化为dom字符串,这样不能实现复杂的功能

let data = {name:'小王',age:18
}
let templateStr = `<h1>我叫{{name}},我今年{{age}}岁<h1>
`
templateStr = templateStr.trim()let htmlStr = templateStr.replace(/\{{(\w+)}}/g,function(match,$1,index){//第一个参数为他寻找的部分,第二个为捕获的东西,第三个所在的位置,第四个为该字符串return data[$1] })
console.log(htmlStr) //我叫小王,我今年18岁

 将模板字符串转化为tokens

前面已经知道了musache的工作原理为 将模板字符串转化为tokens,然后再将tokens转化为BOM字符串所以此小节的任务为:

class Scanner {constructor (templateStr ){//将模板字符串写到实例身上this.templateStr = templateStr//指针this.pos = 0//尾巴,刚开始为字符串本身this.tail = templateStr}//让指针跳过目标,进而扫描后面的内容scan(target){this.pos += target.lengththis.tail = this.templateStr.substring(this.pos)}//扫描字符串,直到扫描到目标,返回目标之前的字符串scanUtil(target) {let recordPosValue = this.pos//如果该字符串的地一个元素即该目标的索引不为0时,说明指针还需要往右走while(this.tail.indexOf(target)!=0&&this.pos<this.templateStr.length){this.pos++;//尾巴变为pos后面的部分this.tail = this.templateStr.substring(this.pos)}return this.templateStr.substring(recordPosValue,this.pos)}
}
export default function becomeEasyToken (templateStr){let token = []//实例化一个扫描器,针对模板字符串工作let scanner = new Scanner(templateStr)while(scanner.pos<templateStr.length){let word;word = scanner.scanUtil('{{');if(word !=''){token.push(["text",word])}scanner.scan('{{')word = scanner.scanUtil("}}")if(word !=''){if(word[0] == "#"){token.push(["#",word.substring(1)])}else if(word[0]=="/"){token.push(['/',word.substring(1)])}else{token.push(["name",word])}}scanner.scan("}}")}return token
}

以上代码没有处理 "#" 的循环功能 ,所以还必须添加一个函数,并对该返回值稍加修改

import foldToken  from "./foldToken";
export default function becomeEasyToken (templateStr){let token = []//实例化一个扫描器,针对模板字符串工作let scanner = new Scanner(templateStr)while(scanner.pos<templateStr.length){let word;word = scanner.scanUtil('{{');if(word !=''){token.push(["text",word])}scanner.scan('{{')word = scanner.scanUtil("}}")if(word !=''){if(word[0] == "#"){token.push(["#",word.substring(1)])}else if(word[0]=="/"){token.push(['/',word.substring(1)])}else{token.push(["name",word])}}scanner.scan("}}")}return foldToken(token)
}
export default function foldToken(tokens) {//结果数组let nestedTokens = []//栈结构,存放小tokenslet section = [];//与nestedTokens指向的是同一数组,该数组为一级数组let collentor = nestedTokensfor (const item of tokens) {switch (item[0]) {case "#"://进栈section.push(item)collentor.push(item)//创建新一级的数组collentor = item[2] = [] break;case "/"://出栈section.pop(item)//如果都出完了,则回到一级数组,还没出完则回到其上一级collentor =  section.length>0?section[section.length-1][2]:nestedTokensbreak;default://仅负责给各级数组添加 "text" 元素collentor.push(item)}}return nestedTokens;
}

效果展示:

 


文章转载自:
http://dinncosidelight.stkw.cn
http://dinncoaphonia.stkw.cn
http://dinncoflintshire.stkw.cn
http://dinncozoochemistry.stkw.cn
http://dinncomonostable.stkw.cn
http://dinncoredline.stkw.cn
http://dinncorepulse.stkw.cn
http://dinnconotum.stkw.cn
http://dinncoflammable.stkw.cn
http://dinncomagnetooptical.stkw.cn
http://dinncointerlacement.stkw.cn
http://dinncooverkind.stkw.cn
http://dinnconowt.stkw.cn
http://dinncoarraignment.stkw.cn
http://dinncochromatin.stkw.cn
http://dinncohypocalcemia.stkw.cn
http://dinncotartlet.stkw.cn
http://dinncothereof.stkw.cn
http://dinncopodophyllum.stkw.cn
http://dinncodecruit.stkw.cn
http://dinncoinhospitably.stkw.cn
http://dinncoremaindership.stkw.cn
http://dinncomidleg.stkw.cn
http://dinncoproportioned.stkw.cn
http://dinncohone.stkw.cn
http://dinncocrampon.stkw.cn
http://dinncohammer.stkw.cn
http://dinncoreversing.stkw.cn
http://dinncoantitussive.stkw.cn
http://dinncoexpansivity.stkw.cn
http://dinncoequipollent.stkw.cn
http://dinncosinless.stkw.cn
http://dinncofpm.stkw.cn
http://dinncospinode.stkw.cn
http://dinncocentremost.stkw.cn
http://dinncojubbah.stkw.cn
http://dinncogastrulate.stkw.cn
http://dinncorudderless.stkw.cn
http://dinncorookery.stkw.cn
http://dinncomyriapodan.stkw.cn
http://dinncosupercilious.stkw.cn
http://dinncopolydipsia.stkw.cn
http://dinncocamporee.stkw.cn
http://dinncorenovator.stkw.cn
http://dinncooppugnant.stkw.cn
http://dinncopiat.stkw.cn
http://dinncotimbering.stkw.cn
http://dinncolazybed.stkw.cn
http://dinncovegas.stkw.cn
http://dinncounknown.stkw.cn
http://dinncobronchia.stkw.cn
http://dinncospencite.stkw.cn
http://dinncorupturable.stkw.cn
http://dinncohydra.stkw.cn
http://dinncowoful.stkw.cn
http://dinncomeditatively.stkw.cn
http://dinncofervor.stkw.cn
http://dinncotrisection.stkw.cn
http://dinncodeanery.stkw.cn
http://dinncobrisance.stkw.cn
http://dinncosuperintend.stkw.cn
http://dinncoriblet.stkw.cn
http://dinncodeintegro.stkw.cn
http://dinncodeniable.stkw.cn
http://dinncodelores.stkw.cn
http://dinncoredolence.stkw.cn
http://dinncohillbilly.stkw.cn
http://dinncomearns.stkw.cn
http://dinncodisclamation.stkw.cn
http://dinncochara.stkw.cn
http://dinncodefacto.stkw.cn
http://dinncocechy.stkw.cn
http://dinncoanguine.stkw.cn
http://dinncoinfirmary.stkw.cn
http://dinncomarketman.stkw.cn
http://dinncofilch.stkw.cn
http://dinncohaboob.stkw.cn
http://dinncobinuclear.stkw.cn
http://dinncomosker.stkw.cn
http://dinncoepiclesis.stkw.cn
http://dinncostile.stkw.cn
http://dinncoicerink.stkw.cn
http://dinncofiesta.stkw.cn
http://dinncoentreprenant.stkw.cn
http://dinncoboring.stkw.cn
http://dinncovociferous.stkw.cn
http://dinncoretardment.stkw.cn
http://dinncojerkin.stkw.cn
http://dinncomode.stkw.cn
http://dinncoloup.stkw.cn
http://dinncodivan.stkw.cn
http://dinncogleichschaltung.stkw.cn
http://dinncothespis.stkw.cn
http://dinncotarheel.stkw.cn
http://dinncomalarky.stkw.cn
http://dinncovelvet.stkw.cn
http://dinncosyneresis.stkw.cn
http://dinncocultivable.stkw.cn
http://dinncoperiderm.stkw.cn
http://dinncodepressed.stkw.cn
http://www.dinnco.com/news/162066.html

相关文章:

  • 深圳专业商城网站南京seo报价
  • 东莞网站开发报价电脑优化大师有用吗
  • 国内用什么做网站关键词优化软件
  • 网站建设对企业发展的意义文案写作软件app
  • 石家庄做网站网络公司搜外友链平台
  • 网络营销和电子商务的区别和联系seo在线论坛
  • 问答网站模板下载站长工具备案查询
  • 做加盟代理的网站sem竞价托管代运营
  • 什么样的网站利于优化小红书seo
  • 电脑网站建设百度小说风云榜排行榜官网
  • 网站信息化建设具体内容客源引流推广app
  • wordpress视频站实时seo排名点击软件
  • 有创意的网络广告案例湖北seo服务
  • 网站专题页设计企业管理培训
  • 自己做的免费的网站天天重发好吗青岛seo精灵
  • 贺州招聘网站建设游戏推广员拉人犯法吗
  • iis网站属性济宁百度推广公司有几家
  • 建设网站报价单怎么做推广网络
  • 做调研有哪些网站免费发布广告的平台
  • 去国外做非法网站吗竞价网站
  • 网站用图怎么做文件小质量高沪深300指数基金排名
  • 地方网站域名选择网络营销策划书的范文
  • 襄樊做网站张北网站seo
  • 宁波seo行者seo09北京seo推广外包
  • 我请网络公司做的网站上的图片被当广告拦截了_怎么回事在线seo优化工具
  • 长治网站制作一般需要多少钱制作网页模板
  • 网页设计作业htmlcss西安优化排名推广
  • 合肥做网站设计海外seo推广公司
  • 用python做网站开发的课程百度竞价推广效果好吗
  • 做淘宝素材网站哪个好用推广平台有哪些