muerwre.github.io/docs/api/_content/query/Llpj9LBd4i.json
2024-03-21 11:24:25 +00:00

1 line
No EOL
8.6 KiB
JSON

{"_path":"/frontend/vue/adding-global-properties-to-component","_dir":"vue","_draft":false,"_partial":false,"_locale":"en","_empty":false,"title":"Adding Global Properties To Component","description":"The topic's fully covered in the official documentation and in Add global variable to window.","excerpt":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The topic's fully covered in the "},{"type":"element","tag":"a","props":{"href":"https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties","rel":["nofollow"]},"children":[{"type":"text","value":"official documentation"}]},{"type":"text","value":" and in "},{"type":"element","tag":"a","props":{"href":"Add%20global%20variable%20to%20window"},"children":[{"type":"text","value":"Add global variable to window"}]},{"type":"text","value":"."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For example, you want to add global "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$http"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$translate"}]},{"type":"text","value":" services to all of project's components:"}]},{"type":"element","tag":"code","props":{"code":"// ~/index.d.ts or ~/custom.d.ts\n\nimport axios from 'axios'\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $http: typeof axios\n $translate: (key: string) => string\n }\n}\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"// ~/index.d.ts or ~/custom.d.ts\n\nimport axios from 'axios'\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $http: typeof axios\n $translate: (key: string) => string\n }\n}\n"}]}]}]}]},"body":{"type":"root","children":[{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"The topic's fully covered in the "},{"type":"element","tag":"a","props":{"href":"https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties","rel":["nofollow"]},"children":[{"type":"text","value":"official documentation"}]},{"type":"text","value":" and in "},{"type":"element","tag":"a","props":{"href":"Add%20global%20variable%20to%20window"},"children":[{"type":"text","value":"Add global variable to window"}]},{"type":"text","value":"."}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"For example, you want to add global "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$http"}]},{"type":"text","value":" and "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"$translate"}]},{"type":"text","value":" services to all of project's components:"}]},{"type":"element","tag":"code","props":{"code":"// ~/index.d.ts or ~/custom.d.ts\n\nimport axios from 'axios'\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $http: typeof axios\n $translate: (key: string) => string\n }\n}\n","language":"typescript"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-026e23"},"children":[{"type":"text","value":"// ~/index.d.ts or ~/custom.d.ts"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-3204ed"},"children":[{"type":"text","value":"import"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-7bada2"},"children":[{"type":"text","value":"axios"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-3204ed"},"children":[{"type":"text","value":"from"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-318f96"},"children":[{"type":"text","value":"'axios'"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-1a2afa"},"children":[{"type":"text","value":"declare"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-1a2afa"},"children":[{"type":"text","value":"module"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-318f96"},"children":[{"type":"text","value":"'vue'"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-1a2afa"},"children":[{"type":"text","value":"interface"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-772f4e"},"children":[{"type":"text","value":"ComponentCustomProperties"}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" {"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" "}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-07f096"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-b5f651"},"children":[{"type":"text","value":"$translate"}]},{"type":"element","tag":"span","props":{"class":"ct-4eb8ad"},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"class":"ct-07f096"},"children":[{"type":"text","value":" ("}]},{"type":"element","tag":"span","props":{"class":"ct-3f2b67"},"children":[{"type":"text","value":"key"}]},{"type":"element","tag":"span","props":{"class":"ct-4eb8ad"},"children":[{"type":"text","value":":"}]},{"type":"element","tag":"span","props":{"class":"ct-07f096"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-41a6a6"},"children":[{"type":"text","value":"string"}]},{"type":"element","tag":"span","props":{"class":"ct-07f096"},"children":[{"type":"text","value":") "}]},{"type":"element","tag":"span","props":{"class":"ct-cd10b7"},"children":[{"type":"text","value":"=>"}]},{"type":"element","tag":"span","props":{"class":"ct-07f096"},"children":[{"type":"text","value":" "}]},{"type":"element","tag":"span","props":{"class":"ct-41a6a6"},"children":[{"type":"text","value":"string"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":" }"}]}]},{"type":"element","tag":"span","props":{"class":"line"},"children":[{"type":"element","tag":"span","props":{"class":"ct-720b32"},"children":[{"type":"text","value":"}"}]}]}]}]}]},{"type":"element","tag":"style","children":[{"type":"text","value":".ct-cd10b7{color:#FF7B72}.ct-41a6a6{color:#79C0FF}.ct-3f2b67{color:#FFA657}.ct-4eb8ad{color:#FF7B72}.ct-b5f651{color:#D2A8FF}.ct-07f096{color:#C9D1D9}.ct-772f4e{color:#FFA657}.ct-1a2afa{color:#FF7B72}.ct-318f96{color:#A5D6FF}.ct-7bada2{color:#C9D1D9}.ct-720b32{color:#C9D1D9}.ct-3204ed{color:#FF7B72}.ct-026e23{color:#8B949E}.light .ct-026e23{color:#93A1A1}.light .ct-3204ed{color:#859900}.light .ct-720b32{color:#657B83}.light .ct-7bada2{color:#268BD2}.light .ct-318f96{color:#2AA198}.light .ct-1a2afa{color:#073642}.light .ct-772f4e{color:#268BD2}.light .ct-07f096{color:#657B83}.light .ct-b5f651{color:#268BD2}.light .ct-4eb8ad{color:#859900}.light .ct-3f2b67{color:#657B83}.light .ct-41a6a6{color:#859900}.light .ct-cd10b7{color:#073642}"}]}],"toc":{"title":"","searchDepth":2,"depth":2,"links":[]}},"_type":"markdown","_id":"content:Frontend:Vue:Adding global properties to component.md","_source":"content","_file":"Frontend/Vue/Adding global properties to component.md","_extension":"md"}