Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
优化代码
Browse files Browse the repository at this point in the history
  • Loading branch information
peak committed Aug 9, 2016
1 parent 9021d59 commit 0c7b05f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 89 deletions.
65 changes: 0 additions & 65 deletions src/buttons.less

This file was deleted.

9 changes: 0 additions & 9 deletions src/dashboard/color.less

This file was deleted.

13 changes: 10 additions & 3 deletions src/dashboard/color.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<style lang="less" src="./color.less"></style>
<style>
.vue-html5-editor .color-card {
margin: 2px;
width: 30px;
height: 30px;
float: left;
cursor: pointer;
}
</style>
<template>
<div>
<div v-for="color in colors" :style="{'background-color':color}" class="color-card" @click="changeColor(color)">
Expand All @@ -20,8 +28,7 @@
},
methods: {
changeColor(color){
var parent = this.$parent
parent.execCommand("foreColor", color)
this.$parent.execCommand("foreColor", color)
}
}
}
Expand Down
9 changes: 4 additions & 5 deletions src/dashboard/link.vue
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<template>
<form @submit="createLink">
<input type="text" placeholder="输入链接地址" v-model="url">
<form @submit.prevent="createLink">
<input type="text" placeholder="输入链接地址" v-model="url" maxlength="1024">
<button type="submit">生成链接</button>
</form>
</template>
<script>
export default {
data(){
return {url: ""}
return {url: null}
},
methods: {
createLink(e){
e.preventDefault()
createLink(){
if (!this.url) {
return
}
Expand Down
13 changes: 6 additions & 7 deletions src/dashboard/table.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<template>
<form @submit="insertTable">
<form @submit.prevent="insertTable">
<label>
行数
<input type="number" style="width: 60px" maxlength="2" min="2" v-model="rows">
<input type="number" style="width: 60px" maxlength="2" min="2" max="10" v-model="rows">
</label>
<label>
列数
<input type="number" style="width: 60px" maxlength="2" min="2" v-model="cols">
<input type="number" style="width: 60px" maxlength="2" min="2" max="10" v-model="cols">
</label>

<button type="submit">确定</button>
Expand All @@ -24,13 +24,12 @@
}
},
methods: {
insertTable(e){
e.preventDefault()
insertTable(){
let component = this
if (component.rows < 2) {
if (component.rows < 2 || component.rows > 10) {
return
}
if (component.cols < 2) {
if (component.cols < 2 || component.cols > 10) {
return
}
let table = "<table style='border-spacing: 0px; border-collapse: collapse; width: 100%; max-width: 100%; margin-bottom: 0px; border: 1px solid rgb(221, 221, 221); color: rgb(51, 51, 51); font-size: 14px; line-height: 20px; background-color: transparent;'><tbody>"
Expand Down

0 comments on commit 0c7b05f

Please sign in to comment.