This repository was archived by the owner on Aug 10, 2022. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 2.5k
[ZH-CN] Translate web-components/index.md into Chinese #8809
          
     Open
      
      
            gitlocalize-app
  wants to merge
  2
  commits into
  main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
gitlocalize-12068
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            2 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      
    File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| project_path: /web/fundamentals/_project.yaml | ||
| book_path: /web/fundamentals/_book.yaml | ||
| description: 组件是现代网络应用的构建块。在构建您自己的组件时,应遵循哪些最佳实践,以便让它们经得起时间的考验? | ||
|  | ||
| {# wf_updated_on: 2018-09-20 #} {# wf_published_on: 2017-08-14 #} {# wf_blink_components: Blink>DOM #} | ||
|  | ||
| <style> | ||
| nav.devsite-page-nav, .devsite-rating-container {display:none;} | ||
| </style> | ||
|  | ||
| # 构建组件 {: .page-title } | ||
|  | ||
| 组件是现代Web应用程序的基础。 当您在构建自己的组件时,您应该遵循哪些实践,以经得起时间的考验? | ||
|  | ||
| <div class="attempt-left"> | ||
| <h2><a href="./customelements">自定义元素 (Custom Elements)</a></h2> | ||
| <a href="./customelements"> | ||
| <img width="48" src="https://github.com/google/WebFundamentals/blob/master/web/images/md-icons/ic_code_black_24px.svg?raw=true" class="attempt-right"> | ||
| </a> | ||
| <p>自定义元素让开发者能够扩展 HTML 和创建自己的标记。由于自定义元素基于标准,他们可以从网络的内置组件模型中受益。这样一来,可以在许多不同的上下文中重用更模块化的代码。</p> | ||
| <a href="./customelements" class="button button-primary">更多内容</a> | ||
| </div> | ||
|  | ||
| <div class="attempt-right"> | ||
| <h2><a href="./shadowdom">Shadow DOM</a></h2> | ||
| <a href="./shadowdom"> | ||
| <img width="48" src="https://github.com/google/WebFundamentals/blob/master/web/images/md-icons/ic_border_style_black_24px.svg?raw=true" class="attempt-right"> | ||
| </a> | ||
| <p> Shadow DOM 是一种提供组件样式和标记封装的网络标准。它是网络组件至关重要的一部分,因为它可以确保组件在任何环境中运行,即使其他 CSS 或 JavaScript 正在页面上运行。</p> | ||
| <a href="./shadowdom" class="button button-primary">更多内容</a> | ||
| </div> | ||
|  | ||
| <div style="clear:both;"></div> | ||
|  | ||
| <div class="attempt-left"> | ||
| <h2><a href="./best-practices">最佳实践</a></h2> | ||
| <a href="./best-practices"> | ||
| <img width="48" src="https://github.com/google/WebFundamentals/blob/master/web/images/md-icons/ic_done_black_24px.svg?raw=true" class="attempt-right"> | ||
| </a> | ||
| <p>由于自定义元素和 Shadow DOM 属于低级别原语,如何充分组合使用它们来创建可靠并且能在许多不同的环境中正常运行的组件并不总是十分清楚。而使用这些 API,您可以实现所有这些,下面是一些可以帮助您确保组件在任何地方都能正常运行的最佳实践。</p> | ||
| <a href="./best-practices" class="button button-primary">更多内容</a> | ||
| </div> | ||
|  | ||
| <div class="attempt-right"> | ||
| <h2><a href="./examples/">示例</a></h2> | ||
| <a href="./examples/"> | ||
| <img width="48" src="https://github.com/google/WebFundamentals/blob/master/web/images/md-icons/ic_explore_black_24px.svg?raw=true" class="attempt-right"> | ||
| </a> | ||
| <p>HowTo-Components 是一组展示自定义元素和 Shadow DOM 最佳实践的元素。这些元素并不用于生产环境,而是作为教学助手来帮助将最佳实践建议映射到实际实现。</p> | ||
| <a href="./examples/" class="button button-primary">更多内容</a> | ||
| </div> | ||
|  | ||
| <div style="clear:both;"></div> | ||
|  | ||
| ## 反馈 {: #feedback } | ||
|  | ||
| {% include "web/_shared/helpful.html" %} | ||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not link to Git repo images, link to them via their original URL please.