{"id":504,"date":"2023-02-25T14:20:55","date_gmt":"2023-02-25T06:20:55","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=504"},"modified":"2023-04-29T20:48:04","modified_gmt":"2023-04-29T12:48:04","slug":"react-native-learning-for-asyncstorage-api","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/25\/react-native-learning-for-asyncstorage-api\/","title":{"rendered":"React Native\u5b66\u4e60\u4e4bAsyncStorage API"},"content":{"rendered":"<p><code>AsyncStorage<\/code>\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u3001\u5177\u6709\u5f02\u6b65\u7279\u6027\u7684\u952e\u503c\u5bf9\u7684\u5b58\u50a8\u7cfb\u7edf\uff0c\u5e76\u4e14\u662f\u5168\u5c40\u7684\uff01\u66ff\u4ee3LocalStorage\u3002\u76f8\u5f53\u4e8e Android \u4e2d\u7684<code>SharedPreference<\/code>\u548c iOS \u4e2d\u7684<code>NSUserDefalut<\/code>\u3002<\/p>\n<p><code>AsyncStorage<\/code>\u91cc\u9762\u90fd\u6709\u4e00\u4e2a\u56de\u8c03\u51fd\u6570\uff0c\u800c\u56de\u8c03\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u90fd\u662f\u9519\u8bef\u5bf9\u8c61\uff0c\u5982\u679c\u53d1\u751f\u9519\u8bef\uff0c\u8be5\u5bf9\u8c61\u5c31\u4f1a\u5c55\u793a\u9519\u8bef\u4fe1\u606f\uff0c\u5426\u5219\u4e3anull\uff1b\u6bcf\u4e2a\u65b9\u6cd5\u90fd\u4f1a\u8fd4\u56de\u4e00\u4e2aPromise\u5bf9\u8c61\u3002<\/p>\n<p>\u83b7\u53d6<code>AsyncStorage<\/code>\u4e2d\u5b58\u50a8\u7684\u6570\u636e\uff0c\u4e00\u5b9a\u662f\u5728<code>DidMount<\/code>\u751f\u547d\u5468\u671f\u91cc\uff0c\u4e0d\u80fd\u5728<code>WillMount<\/code>\u91cc\u3002<\/p>\n<p><!-- more --><\/p>\n<ul>\n<li><code>static getItem(key: string, callback: (error, result))<\/code>\uff1a\u6839\u636e\u952e\u6765\u83b7\u53d6\u503c\uff0c\u83b7\u53d6\u7684\u7ed3\u679c\u4f1a\u5728\u56de\u8c03\u51fd\u6570\u4e2d<\/li>\n<li><code>static setItem(key: string, value: string, callback: (error))<\/code>: \u8bbe\u7f6e\u952e\u503c\u5bf9<\/li>\n<li><code>static removeItem(key: string, callback: (error))<\/code>\uff1a\u5c06\u6839\u636e\u952e\u79fb\u51fa\u4e00\u9879<\/li>\n<li><code>static mergeItem(key: string, value: string,  callback: (error))<\/code>\uff1a\u5408\u5e76\u73b0\u6709\u7684\u503c\u548c\u8f93\u5165\u503c<\/li>\n<li>`static clear(callback: (error))\uff1a\u6e05\u9664\u6240\u6709\u7684\u9879\u76ee<\/li>\n<li><code>static getAllKeys(callback: (error))<\/code>\uff1a\u83b7\u53d6\u6240\u6709\u7684\u952e<\/li>\n<li><code>static multiGet(keys, callback: (errors, result))<\/code>\uff1a\u83b7\u53d6\u591a\u9879\uff0c\u5176\u4e2dkeys\u662f\u5b57\u7b26\u4e32\u6570\u7ec4\u3002<\/li>\n<li><code>static multiSet(keyValuePairs, callback: (error))<\/code>\uff1a\u8bbe\u7f6e\u591a\u9879\uff0c\u5176\u4e2dkeyValuePairs\u662f\u5b57\u7b26\u4e32\u7684\u4e8c\u7ef4\u6570\u7ec4<\/li>\n<li><code>static multiRemove(keys, callback: (error))<\/code>\uff1a\u5220\u9664\u591a\u9879\uff0c\u5176\u4e2dkeys\u662f\u5b57\u7b26\u4e32\u6570\u7ec4<\/li>\n<li><code>static multiMerge(keyValuePairs, callback: (error))<\/code>\uff1a\u591a\u4e2a\u952e\u503c\u5408\u5e76\uff0c\u5176\u4e2dkeyValuePairs\u662f\u5b57\u7b26\u4e32\u4e2d\u7684\u4e8c\u7ef4\u6570\u7ec4<\/li>\n<\/ul>\n<p>\u6848\u4f8b\uff1a\u8d2d\u7269\u8f66\uff08\u6570\u636e\u5171\u4eab\uff09\uff0c\u5305\u542b\u5217\u8868\u9875\u548c\u7ed3\u7b97\u9875<\/p>\n<ul>\n<li>\u6570\u636e\u6a21\u578b\u6784\u5efa<\/li>\n<li>\u5217\u8868\u9879Item\u7ec4\u4ef6\uff08es6\u4e2d\u9ed8\u8ba4\u5c5e\u6027\u4e0e\u5c5e\u6027\u7c7b\u578b\u7684\u5b9a\u4e49\uff09<\/li>\n<li>\u5217\u8868\u7ec4\u4ef6List<\/li>\n<li>\u8d2d\u7269\u8f66\u7ec4\u4ef6<\/li>\n<li>\u4e32\u8054\u7ec4\u4ef6<\/li>\n<\/ul>\n<p>\u63a8\u8350\u7531React Native\u4e2d\u6587\u7f51\u5c01\u88c5\u7ef4\u62a4\u7684react-native-storage\u6a21\u5757\uff0c\u63d0\u4f9b\u4e86\u8f83\u591a\u4fbf\u5229\u529f\u80fd\u3002<\/p>\n<pre><code class=\"language-javascript\">\/**\n * Sample React Native App\n * https:\/\/github.com\/facebook\/react-native\n *\/\n\nimport React, { Component } from &#039;react&#039;;\nimport {\n    AppRegistry,\n    StyleSheet,\n    Text,\n    Navigator,\n    ScrollView,\n    Image,\n    AsyncStorage,\n    TouchableOpacity,\n    View,\n} from &#039;react-native&#039;;\n\nimport Dimensions from &#039;Dimensions&#039;;\n\nconst width = Dimensions.get(&#039;window&#039;).width;\nconst height = Dimensions.get(&#039;window&#039;).height;\n\nconst Model = [\n    {\n        id: &#039;1&#039;,\n        title: &#039;\u7ea2\u5fc3\u7315\u7334\u6843&#039;,\n        desc: &#039;12\u4e2a\u88c570-90g\/\u4e2a&#039;,\n        price: 49,\n        url: &#039;http:\/\/note.youdao.com\/yws\/api\/personal\/file\/62EAF0C6AC8142EA89B11A71BB6C8AEC?method=download&amp;inline=true&amp;shareKey=e6b1c5b1307f752c9e4925056a4facd9&#039;,\n    },\n    {\n        id: &#039;2&#039;,\n        title: &#039;\u7ea2\u5bcc\u58eb\u82f9\u679c&#039;,\n        desc: &#039;5kg\u679c\u5f8480-85mm&#039;,\n        price: 109,\n        url: &#039;http:\/\/note.youdao.com\/yws\/api\/personal\/file\/E38B11859CB2496190BF5A559D9E68B5?method=download&amp;inline=true&amp;shareKey=1dabf3633a1051e9f5d2d7470fd91c0b&#039;,\n    },\n    {\n        id: &#039;3&#039;,\n        title: &#039;\u54c8\u5bc6\u74dc&#039;,\n        desc: &#039;2\u4e2a\u88c51.4kg\u4ee5\u4e0a\/\u4e2a&#039;,\n        price: 42,\n        url: &#039;http:\/\/note.youdao.com\/yws\/api\/personal\/file\/F443648C199346FDA7E48AE88D0D00A2?method=download&amp;inline=true&amp;shareKey=89fdcc577f98ecdddfcf03f575767381&#039;,\n    },\n    {\n        id: &#039;4&#039;,\n        title: &#039;\u9752\u8292&#039;,\n        desc: &#039;1kg500g\u4ee5\u4e0a\/\u4e2a&#039;,\n        price: 28,\n        url: &#039;http:\/\/note.youdao.com\/yws\/api\/personal\/file\/8F7B83A47CA94435A2132DC0341AECC3?method=download&amp;inline=true&amp;shareKey=d679e8800b5678f9c673538b93dc0fbc&#039;,\n    },\n    {\n        id: &#039;5&#039;,\n        title: &#039;\u9ed1\u73cd\u73e0\u8461\u8404&#039;,\n        desc: &#039;1kg\u88c5&#039;,\n        price: 32,\n        url: &#039;http:\/\/note.youdao.com\/yws\/api\/personal\/file\/AF297F8C75714DE481E87C6F09D97649?method=download&amp;inline=true&amp;shareKey=8f89c3673e8851efb20abccce2214fbf&#039;,\n    },\n    {\n        id: &#039;6&#039;,\n        title: &#039;\u7ea2\u5fc3\u706b\u9f99\u679c&#039;,\n        desc: &#039;2.5kg\u88c5250-350g\/\u4e2a&#039;,\n        price: 59.9,\n        url: &#039;http:\/\/note.youdao.com\/yws\/api\/personal\/file\/B67D0D453865459594C0FDC6CDE95A79?method=download&amp;inline=true&amp;shareKey=3bc5b3b1ee9f13e3a7ebdd251d117796&#039;,\n    },\n];\n\nclass RNAPP extends Component {\n    render() {\n        let defaultName = &#039;Home&#039;;\n        let defaultComponent = Home;\n        return (\n            &lt;Navigator\n                initialRoute = {{ name: defaultName, component: defaultComponent }}\n                \/\/\u914d\u7f6e\u573a\u666f\n                configureScene = {\n                    (route) =&gt; {\n                        \/\/\u8fd9\u4e2a\u662f\u9875\u9762\u4e4b\u95f4\u8df3\u8f6c\u65f6\u5019\u7684\u52a8\u753b\uff0c\u5177\u4f53\u6709\u54ea\u4e9b\uff1f\u53ef\u4ee5\u770b\u8fd9\u4e2a\u76ee\u5f55\u4e0b\uff0c\u6709\u6e90\u4ee3\u7801\u7684: node_modules\/react-native\/Libraries\/CustomComponents\/Navigator\/NavigatorSceneConfigs.js\n                        return Navigator.SceneConfigs.VerticalDownSwipeJump;\n                    }\n                }\n                renderScene = {\n                    (route, navigator) =&gt; {\n                        let Component = route.component;\n                        return &lt;Component {...route.params} navigator={navigator} \/&gt;\n                    }\n                }\n            \/&gt;\n        );\n    }\n}\n\nclass Home extends Component {\n    render() {\n        return (\n            &lt;List navigator={this.props.navigator} \/&gt;\n        );\n    }\n}\n\nclass Item extends Component {\n    static defaultProps = {\n        url: &#039;&#039;,\n        title: &#039;\u9ed8\u8ba4\u6807\u9898&#039;,\n    };\n\n    static propTypes = {\n        url: React.PropTypes.string.isRequired,\n        title: React.PropTypes.string.isRequired,\n    };\n\n    render() {\n        return (\n            &lt;View style={styles.item}&gt;\n                &lt;TouchableOpacity onPress={this.props.press}&gt;\n                    &lt;Image\n                        resizeMode=&#039;stretch&#039;\n                        style={styles.img}\n                        source={{ uri: this.props.url }}\n                        &gt;\n                        &lt;Text numberOfLines={1} style={styles.item_text}&gt;{this.props.title}&lt;\/Text&gt;\n                    &lt;\/Image&gt;\n                &lt;\/TouchableOpacity&gt;\n            &lt;\/View&gt;\n        );\n    }\n}\n\nclass List extends Component {\n    constructor(props) {\n        super(props);\n        this.state = {\n            count: 0,\n        };\n    }\n\n    render() {\n        let list = [];\n        for (let i in Model) {\n            if (i % 2 === 0) {\n                \/\/\u4e24\u4e2a\u7b49\u53f7\uff1a\u4e0d\u5224\u65ad\u7c7b\u578b\n                \/\/\u4e09\u4e2a\u7b49\u53f7\uff1a\u5224\u65ad\u7c7b\u578b\n                let row = (\n                    &lt;View style={styles.row} key={i}&gt;\n                        &lt;Item\n                            title={Model[i].title}\n                            url={Model[i].url}\n                            press={this.press.bind(this, Model[i]) }\n                            &gt;\n                        &lt;\/Item&gt;\n                        &lt;Item\n                            title={Model[parseInt(i) + 1].title}\n                            url={Model[parseInt(i) + 1].url}\n                            press={this.press.bind(this, Model[parseInt(i) + 1]) }\n                            &gt;\n                        &lt;\/Item&gt;\n                    &lt;\/View&gt;\n                );\n                list.push(row);\n            }\n        }\n\n        let count = this.state.count;\n        let str = null;\n        if (count) {\n            str = &#039;, \u5171&#039; + count + &#039;\u4ef6\u5546\u54c1&#039;;\n        }\n        console.log(&#039;count=&#039; + count);\n\n        return (\n            &lt;ScrollView style={{ marginTop: 10 }}&gt;\n                {list}\n                &lt;Text onPress={this.goGouWu.bind(this) } style={styles.btn}&gt;\u53bb\u7ed3\u7b97{str}&lt;\/Text&gt;\n            &lt;\/ScrollView&gt;\n        );\n    }\n\n    goGouWu() {\n        \/\/alert(&#039;\u70b9\u51fb\u4e86\u53bb\u8d2d\u7269\u8f66&#039;);\n        const { navigator } = this.props;\n        \/\/\u4e3a\u4ec0\u4e48\u8fd9\u91cc\u53ef\u4ee5\u53d6\u5f97 props.navigator?\u8bf7\u770b\u4e0a\u6587:\n        \/\/&lt;Component {...route.params} navigator={navigator} \/&gt;\n        \/\/\u8fd9\u91cc\u4f20\u9012\u4e86navigator\u4f5c\u4e3aprops\n        const _that = this;\n        if (navigator) {\n            navigator.push({\n                name: &#039;GouWu&#039;,\n                component: GouWu,\n                params:{\n                    getCount: function(count) {\n                        _that.setState({\n                            count: count,\n                        });\n                        console.log(&#039;\u53c2\u6570\u4f20\u56de&#039;);\n                    },\n                },\n            })\n        }\n    }\n\n    press(data) {\n        this.setState({\n            count: this.state.count + 1,\n        });\n        \/\/AsyncStorage\u5f02\u6b65\u5b58\u50a8\n        AsyncStorage.setItem(&#039;SP-&#039; + this.genId() + &#039;-SP&#039;, JSON.stringify(data), function (err) {\n            if (err) {\n                \/\/TODO\uff1a\u5b58\u50a8\u51fa\u9519\n                alert(err);\n            } else {\n                \/\/alert(&#039;\u4fdd\u5b58\u6210\u529f&#039;);\n            }\n        });\n    }\n\n    \/\/\u751f\u6210\u968f\u673aID\uff1aGUID \u5168\u5c40\u552f\u4e00\u6807\u8bc6\u7b26\uff08GUID\uff0cGlobally Unique Identifier\uff09\u662f\u4e00\u79cd\u7531\u7b97\u6cd5\u751f\u6210\u7684\u4e8c\u8fdb\u5236\u957f\u5ea6\u4e3a128\u4f4d\u7684\u6570\u5b57\u6807\u8bc6\u7b26\n    \/\/GUID\u751f\u6210\u7684\u4ee3\u7801\u6765\u81ea\u4e8eStoyan Stefanov\n    genId() {\n        return &#039;xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx&#039;.replace(\/[xy]\/g, function(c) {\n            let r = Math.random()*16|0, v = c == &#039;x&#039; ? r : (r&amp;0x3|0x8);\n            return v.toString(16);\n        }).toUpperCase();\n    }\n\n    componentDidMount() {\n        let _that = this;\n        AsyncStorage.getAllKeys(\n            function (err, keys) {\n                if (err) {\n                    \/\/TODO:\u5b58\u50a8\u53d6\u6570\u636e\u51fa\u9519\n                    \/\/\u7ed9\u7528\u6237\u63d0\u793a\u9519\u8bef\u4fe1\u606f\n                    console.log(err);\n                } else {\n                    console.log(&#039;\u8bfb\u53d6\u6210\u529f\u7684\u4e2a\u6570\uff1a&#039;+keys.toString());\n                }\n                _that.setState({\n                    count: keys.length,\n                });\n            }\n        );\n    }\n}\n\nclass GouWu extends Component {\n    constructor(props) {\n        super(props);\n        this.state = {\n            price: 0,\n            data: [],\n        };\n    }\n\n    render() {\n        \/\/\u7b2c\u4e8c\u6b21render\u7684\u65f6\u5019 data\u4e0d\u4e3a\u7a7a\n        let data = this.state.data;\n        let price = this.state.price;\n        let list = [];\n        for (let i in data) {\n            price += parseFloat(data[i].price);\n            list.push(\n                &lt;View style={[styles.row, styles.list_item]} key={i}&gt;\n                    &lt;Text style={styles.list_item_desc}&gt;\n                        {data[i].title}\n                        {data[i].desc}\n                    &lt;\/Text&gt;\n                    &lt;Text style={styles.list_item_price}&gt;\u4eba\u6c11\u5e01: {data[i].price}&lt;\/Text&gt;\n                &lt;\/View&gt;\n            );\n        }\n\n        let str = null;\n        if (price) {\n            str = &#039;, \u5171&#039; + price.toFixed(2) + &#039;\u5143&#039;;\n        }\n\n        return (\n            &lt;ScrollView style={{ marginTop: 10 }}&gt;\n                {list}\n                &lt;Text style={styles.btn} onPress={this.paySuccess.bind(this)} &gt;\u652f\u4ed8{str}&lt;\/Text&gt;\n                &lt;Text style={styles.clear} onPress={this.clearStorage.bind(this) }&gt;\u6e05\u7a7a\u8d2d\u7269\u8f66&lt;\/Text&gt;\n            &lt;\/ScrollView&gt;\n        );\n    }\n\n    componentDidMount() {\n        let _that = this;\n        AsyncStorage.getAllKeys(\n            function (err, keys) {\n                if (err) {\n                    \/\/TODO \u5b58\u50a8\u6570\u636e\u51fa\u9519\n                    return;\n                }\n                \/\/keys\u662f\u5b57\u7b26\u4e32\u6570\u7ec4\n                AsyncStorage.multiGet(keys, function (err, result) {\n                    \/\/\u5f97\u5230\u7684\u7ed3\u6784\u662f\u4e8c\u7ef4\u6570\u7ec4\n                    \/\/result[i][0]\u8868\u793a\u6211\u4eec\u5b58\u50a8\u7684\u952e\uff0cresult[i][1]\u8868\u793a\u6211\u4eec\u5b58\u50a8\u7684\u503c\n                    let arr = [];\n                    for (let i in result) {\n                        arr.push(JSON.parse(result[i][1]));\n                    }\n\n                    _that.setState({\n                        data: arr,\n                    });\n                });\n            }\n        );\n    }\n\n    paySuccess() {\n        var _that = this;\n        AsyncStorage.clear(function(err){\n            if (!err) {\n                _that.setState({\n                    data: [],\n                    price: 0,\n                });\n\n                const { navigator } = _that.props;\n                if (_that.props.getCount) {\n                    _that.props.getCount(0);\n                }\n\n                alert(&quot;\u652f\u4ed8\u6210\u529f\uff01&quot;)\n\n                if (navigator) {\n                    navigator.pop();\n                }\n                \/\/_that.props.navigator.pop();\n            }\n        });\n    }\n\n    clearStorage() {\n        let _that = this;\n        AsyncStorage.clear(function (err) {\n            if (!err) {\n                _that.setState({\n                    data: [],\n                    price: 0,\n                });\n                alert(&#039;\u8d2d\u7269\u8f66\u5df2\u7ecf\u6e05\u7a7a&#039;);\n            }\n        });\n    }\n}\n\nconst styles = StyleSheet.create({\n    list_item: {\n        marginLeft: 5,\n        marginRight: 5,\n        padding: 5,\n        borderWidth: 1,\n        height: 32,\n        borderRadius: 3,\n        borderColor: &#039;#ddd&#039;,\n    },\n    list_item_desc: {\n        flex: 2,\n        fontSize: 15,\n    },\n    list_item_price: {\n        flex: 1,\n        fontSize: 15,\n        textAlign: &#039;right&#039;,\n    },\n    clear: {\n        marginTop: 10,\n        backgroundColor: &#039;#FF7200&#039;,\n        color: &#039;#fff&#039;,\n        borderWidth: 1,\n        borderColor: &#039;#ddd&#039;,\n        marginLeft: 10,\n        marginRight: 10,\n        lineHeight: 24,\n        height: 33,\n        fontSize: 18,\n        textAlign: &#039;center&#039;,\n        textAlignVertical: &#039;center&#039;,\n    },\n    btn: {\n        flex: 1,\n        backgroundColor: &#039;#FF7200&#039;,\n        height: 33,\n        textAlign: &#039;center&#039;,\n        textAlignVertical: &#039;center&#039;,\n        color: &#039;#fff&#039;,\n        marginLeft: 10,\n        marginRight: 10,\n        lineHeight: 24,\n        marginTop: 40,\n        fontSize: 18,\n    },\n    row: {\n        flexDirection: &#039;row&#039;,\n        marginBottom: 10,\n    },\n    img: {\n        flex: 1,\n        backgroundColor: &#039;transparent&#039;,\n    },\n    item_text: {\n        backgroundColor: &#039;#000&#039;,\n        opacity: 0.7,\n        color: &#039;#fff&#039;,\n        height: 25,\n        lineHeight: 18,\n        textAlign: &#039;center&#039;,\n        marginTop: 94,\n    },\n    item: {\n        flex: 1,\n        marginLeft: 5,\n        borderWidth: 1,\n        borderColor: &#039;#ddd&#039;,\n        marginRight: 5,\n        height: 120,\n    },\n    list: {\n        justifyContent: &#039;flex-start&#039;,\n        flexDirection: &#039;row&#039;,\n        flexWrap: &#039;wrap&#039;\n    },\n    container: {\n\n        flex: 1,\n    },\n    listView: {\n        paddingTop: 20,\n        backgroundColor: &#039;#F5FCFF&#039;,\n    },\n    thumbnail: {\n        width: 80,\n        height: 80,\n        borderRadius: 16,\n    },\n    \/\/\u4f7frightContainer\u5728\u7236\u5bb9\u5668\u4e2d\u5360\u636eImage\u4e4b\u5916\u5269\u4e0b\u7684\u5168\u90e8\u7a7a\u95f4\n    container1: {\n        flex: 1,\n        justifyContent: &#039;center&#039;,\n        alignItems: &#039;center&#039;,\n    },\n    title: {\n        fontSize: 14,\n        marginBottom: 8,\n    },\n    year: {\n        fontSize: 14,\n    },\n});\n\nAppRegistry.registerComponent(&#039;RNAPP&#039;, () =&gt; RNAPP);<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>AsyncStorage\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u3001\u5177\u6709\u5f02\u6b65\u7279\u6027\u7684\u952e\u503c\u5bf9\u7684\u5b58\u50a8\u7cfb\u7edf\uff0c\u5e76\u4e14\u662f\u5168\u5c40\u7684\uff01\u66ff\u4ee3LocalStorag [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[163],"tags":[],"class_list":["post-504","post","type-post","status-publish","format-standard","hentry","category-react-native"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=504"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/504\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}