Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="app">
  <h1 class="text-center mb-5">
    <a href="http://github.com/TerryZ/v-region" target="_blank">v-region</a>
  </h1>
  <div class="text-center">The region selector for Vue2</div>
  <p class="text-center">Example version: <strong>v2.2.2</strong></p>
  <br><br><br>
    
  <h3>常规表单下拉选择元素模式</h3>
  <p>Regular form element with select tag</p>
  <v-region :town="true"></v-region>

  <br><br><br>
  <h3>纯文本显示模式</h3>
  <p>Display initialized region info by Plain Text</p>
  <div class="text-container">
    <v-region :town="true" type="text" v-model="selected">
    </v-region>
  </div>

  <br><br>
  <h3>多分组切换模式</h3>
  <p>Tab group</p>

  <div class="bg-light p-3 mb-3">
    <strong>v-model value</strong>
    <pre class="m-0 mb-3" v-text="JSON.stringify(modelGroup, null, 2)"></pre>
    <strong>values event return</strong>
    <pre class="m-0" v-text="JSON.stringify(valuesGroup, null, 2)"></pre>
  </div>
  <!-- customize region selector toggle, remove the button to use default toggle  -->
  <v-region 
    :town="true"
    type="group"
    v-model="modelGroup"
    @values="regionChange"
  >
  </v-region>
  
  <h5 class="mt-3">自定义呼出按钮</h5>
  <p>Custom v-region toggle</p>
  <v-region type="group" >
    <template #default="{ region, show }">
      <button type="button" class="btn btn-primary">
        region:{{resultText(region)}},
        show: {{show}}
      </button>
    </template>
  </v-region>



  <br><br><br>
  <h3>多列竖排模式</h3>
  <p>Column group</p>
  <v-region type="column" @values="regionChange" >
  </v-region>

  <br><br><br>
  <h3>城市选择器</h3>
  <p>City picker</p>
  <v-region type="city" :city-picker="true" >
  </v-region>
    
    
    
</div>

<div class="blankSpace">
              
            
!

CSS

              
                #app{
    padding: 50px;
}
.blankSpace {
    height: 500px;
}
.text-container{
    background-color: #eee;
    padding: 20px;
    border-radius: 4px;
}
              
            
!

JS

              
                Vue.use(vRegion.default)

new Vue({
  el: "#app",
  data() {
    return {
      btnText: 'please select',
      selected: {
          province: '350000',
          city: '350100',
          area: '350104',
          town: '350104008'
      },
      modelGroup: {},
      valuesGroup: {}
    }
  },
  methods: {
    regionChange(d) {
      this.valuesGroup = d
    },
    resultText (region) {
      if (!Object.values(region).some(val => val) || !region) return 'null'
      return Object.values(region).filter(val => val).map(val => val.value).join(',')
    }
  }
})

              
            
!
999px

Console