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

              
                <script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.3.7/lib/index.js"></script>
<div id="app">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
  <el-form-item label="label值" prop="resource">
    <el-radio-group v-model="ruleForm.resource">
      <el-radio label="510104">锦江区</el-radio>
      <el-radio label="510108">成华区</el-radio>
      <el-radio label="510106">金牛区</el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item label=":label值" prop="resource2">
    <el-radio-group v-model="ruleForm.resource2">
      <el-radio :label="510104">锦江区</el-radio>
      <el-radio :label="510108">成华区</el-radio>
      <el-radio :label="510106">金牛区</el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item label=":label值(动态)" prop="resource3">
    <el-radio-group v-model="ruleForm.resource3">
      <el-radio v-for="item in ruleForm.resourceArry" :key="item.value" :label="item.value">{{item.label}}</el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item label=":label值(动态)" prop="resource4">
    <el-radio-group v-model="ruleForm.resource4">
      <el-radio v-for="item2 in ruleForm.resourceArry2" :key="item2.value" :label="item2.value">{{item2.label}}</el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="submitForm('ruleForm')">立即创建</el-button>
    <el-button @click="resetForm('ruleForm')">重置</el-button>
  </el-form-item>
</el-form>
</div>
              
            
!

CSS

              
                @import url("//unpkg.com/element-ui@2.3.7/lib/theme-chalk/index.css");
              
            
!

JS

              
                var Main = {
    data() {
      return {
        ruleForm: {
          // resource: '',//默认不选中
          resource: '510108',//选中第二项
          resource2: 510108,//选中第二项,如果是string(如510108')会不生效
          resource3: '510108',//选中第二项,resourceArry中的value值时string则这里是string,resourceArry中的value值时number则这里是number,
          resourceArry: [{value:'510104',label:'锦江区'},{value:'510108',label:'成华区'},{value:'510106',label:'金牛区'}],
          resource4: 510108,//选中第二项
          resourceArry2: [{value:510104,label:'锦江区'},{value:510108,label:'成华区'},{value:510106,label:'金牛区'}],
        },
        rules: {
          resource: [
            { required: true, message: '请选择活动资源', trigger: 'change' }
          ],
       
        }
      };
    },
    methods: {
      submitForm(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }
    }
  }
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
              
            
!
999px

Console