vue 實現頁面靜態化

2021-09-26 21:46:13 字數 841 閱讀 2896

使用 this.$router.push(location) 來修改 url,完成頁面路由跳轉使用params來隱式傳遞url的引數,它類似post,url看不出,使用query來傳遞引數的話,類似get,url一定會被格式化為而不能自定義,以html字尾結尾

checkdetail: async function (articleid, viewcount) })

}

created: function () 

obj.article_id = this.$route.params.detailid.slice(0, -5)

// 取文章detail資料

this.$store.commit('setarticles', obj)

},

至此,已基本上實現vue的偽靜態需求,理論上可以針對任何頁面做偽靜態

這裡會有乙個坑,是這樣的,當你同乙個路由的時候,只是引數變化了,變化後需要手動重新整理,資料才出來,顯然是達不到需求的

把created裡的**,抽取到method裡面,使用vue的watch監測路由變化

created: function () ,

methods:

obj.article_id = this.$route.params.detailid.slice(0, -5)

// 取文章detail資料

this.$store.commit('setarticles', obj)

}},watch: ,

php實現頁面靜態化

php生成靜態html頁面的方法 1.gid get gid 0 商品id goods statis file goods file gid.html 對應靜態頁檔案 expr 3600 24 10 靜態檔案有效期,十天 if file exists goods statis file else e...

PHP實現頁面靜態化

一 buffer認知 buffer php存在的緩衝區,乙個記憶體位址空間,主要用於儲存資料區域 可在php.ini中開啟引數 output buffering on 或者在php檔案中手動開啟 ob start 開啟輸出控制緩衝 ob get contents 返回輸出緩衝區內容 ob clean...

Go實現頁面靜態化

tmpl,err template.parsefiles hello.tmpl product,err p.productservice.getproductbyid int64 productid file,err os.openfile filename,os.o create os.o wro...