221-prismic 中文文档教程
221-Prismic
How to use
导入包:
let Content = require('221-prismic')
从所有文档中获取数据:
const content = new Content({
baseUrl: 'myprismicrepo',
debug: true,
lang: 'fr-fr'
})
错误回调:
content.onError((err) => {
console.log("Something went wrong: ", err)
})
成功回调(获取数据):
content.onReady(() => {
console.log("Got data")
})
获取所有密钥:
var key = content.get()
获取文档的
var key = content.get('header')
密钥:获取文档的特定密钥:
var key = content.get('header.item1')
Links
Github:https://github.com/Studio221/221-Prismic
221-Prismic
How to use
Import package :
let Content = require('221-prismic')
Get data from all documents :
const content = new Content({
baseUrl: 'myprismicrepo',
debug: true,
lang: 'fr-fr'
})
Error callback :
content.onError((err) => {
console.log("Something went wrong: ", err)
})
Success callback (got data) :
content.onReady(() => {
console.log("Got data")
})
Get all keys:
var key = content.get()
Get keys of doc:
var key = content.get('header')
Get specific keys of doc:
var key = content.get('header.item1')
Links
Github : https://github.com/Studio221/221-Prismic