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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                #app
  el-table(:data="tableData",row-key="id",highlight-current-row,style="width: 100%",@cell-click="iconOperation")
    el-table-column(prop="iconOperation",label="",width="50px")
      template(slot-scope="scope")
        i.el-icon-check(v-if="scope.row.isEditing")
        i.el-icon-edit(v-else)
    el-table-column(prop="name",label="姓名",width="150px")
      template(slot-scope="scope")
        el-input(v-if="scope.row.isEditing",size="small",v-model="scope.row.name",placeholder="請輸入內容")
        span(v-else) {{scope.row.name}}
    el-table-column(prop="birth",label="生日",width="180px")
      template(slot-scope="scope")
        el-date-picker(v-if="scope.row.isEditing",type="date",
      placeholder="選擇日期",v-model="scope.row.birth",value-format="yyyy-MM-dd")
        span(v-else) {{scope.row.birth}}
    el-table-column(prop="age",label="年齡",width="140px")
      template(slot-scope="scope")
        el-input-number(v-if="scope.row.isEditing",
                        v-model="scope.row.age",
                        controls-position="right",size="small"
                        :min="1",:max="100")
        span(v-else) {{scope.row.age}}
    el-table-column(prop="address",label="地址",width="300px")
      template(slot-scope="scope")
        el-input(v-if="scope.row.isEditing",
                size="small",
                v-model="scope.row.address",
                placeholder="請輸入內容")
        span(v-else) {{scope.row.address}}
    el-table-column(prop="sex",label="姓別",width="80px")
      template(slot-scope="scope")
        el-select(v-if="scope.row.isEditing",
                  v-model="scope.row.sex",
                  placeholder="請選擇")
          el-option(v-for="item in options",
                    :key="item.value",
                    :label="item.label",
                    :value="item.label")
        span(v-else) {{scope.row.sex}}
              
            
!

CSS

              
                @import url(//fonts.googleapis.com/earlyaccess/notosanstc.css)
*
  font-family: 'Noto Sans TC', '微軟正黑體', '黑體' , 'Arial'
              
            
!

JS

              
                let app = new Vue({
   el: "#app",
   data: {
     tableData:[{
       id: 1,
       name: '王小明',
       sex: '男',
       age: 18,
       birth:'1990-06-25',
       address: '台北市大安區仁愛路三段',
       isEditing: true,
     },{
       id: 2,
       name: '張大花',
       sex: '女',
       age: 16,
       birth:'1990-06-25',
       address: '台北市大安區仁愛路三段',
       isEditing: false,
     },{
       id:3,
       name: '陳中天',
       birth:'1990-06-25',
       sex: '男',
       age: 22,
       address: '台北市大安區仁愛路三段',
       isEditing: false,
     },],
     options:[{value:"1",label:"男"},{value:"0",label:"女"}]
   },
  methods:{
    iconOperation(row, column, cell, event){
        if(column.property ==="iconOperation"){
          row.isEditing = !row.isEditing
        }
    }
  }
});
              
            
!
999px

Console