codecamp

Generator Class

Generator Class

Hooks

我们可以在某些生命周期事件中注册钩子。

HookArgumentsWhen
generate:before(nuxt, generateOptions)钩子(hook)生成之前
generate:distRemoved(nuxt)钩子(hook)目标文件夹已清理
generate:distCopied(nuxt)钩子(hook)复制静态和构建文件
generate:page({route, path, html})钩子(hook)让用户更新path&html
generate:routeCreated(route, path, errors)钩子(hook)生成页面成功
generate:extendRoutes(routes)钩子(hook)让用户更新要生成的路由
generate:routeFailed(route, errors)钩子(hook)保存生成的页面失败
generate:done(nuxt, errors)钩子(hook)生成完毕


Builder Class
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }