我不确定我是否错过了什么但是当我console.log
我的attributes
我得到一个空对象。它不应该显示我所有属性的默认数据吗。我在这里做错了什么。
import { __ } from \'@wordpress/i18n\';
import { registerBlockType } from \'@wordpress/blocks\';
import { useEffect } from \'@wordpress/blocks\';
import { PluginDocumentSettingPanel } from \'@wordpress/edit-post\';
import GoogleMap from \'./GoogleMap.js\';
import { Component } from \'@wordpress/element\';
import axios from \'axios\';
registerBlockType( \'splash-blocks/google-maps\', {
title: __(\'Google maps locations\', \'google-maps\'),
icon: \'megaphone\',
category: \'common\',
keyword: [
__( \'Display Google maps locations\' ),
],
atrributes: {
markers: {
type: \'array\',
default: [{
lat: 37.79406,
lng: -122.4002,
}],
},
icon: {
},
address: {
type: \'string\',
default: \'xxxxxxxxx\',
},
api_key: {
type: \'string\',
default: \'xxxxxxxxx\',
}
},
edit({ attributes, setAttributes }) {
console.log(attributes)
//Console shows empty object
return (
<div id=\'google-map\'>
</div>
)
},
save: null,
})