提交 06a8284c 编写于 作者: B baiy 提交者: ninecents

优化剪贴板操作和部分输入逻辑

上级 11db7f6c
...@@ -10,6 +10,5 @@ ...@@ -10,6 +10,5 @@
<div id="page" style="width: 800px;height: 550px;margin: 0 auto;padding: 0 10px;overflow-y:auto;"> <div id="page" style="width: 800px;height: 550px;margin: 0 auto;padding: 0 10px;overflow-y:auto;">
<div id="app"></div> <div id="app"></div>
</div> </div>
<div id="clipboard"></div>
</body> </body>
</html> </html>
import {isUtools} from '../helper' import {Base64} from "js-base64";
// 剪贴板操作 // 剪贴板操作
export const copy = (data,successCallback)=>{ export const copy = (data, successCallback) => {
document.querySelector( try {
'#clipboard').innerHTML = '<textarea id="clipboard-text"></textarea>' navigator.clipboard.writeText(data).then(function () {
document.querySelector('#clipboard-text').value = data successCallback && successCallback()
document.querySelector('#clipboard-text').select() }, function (e) {
if (document.execCommand('copy')) { console.log('copy failed', e)
successCallback && successCallback() });
} catch (e) {
console.log('copy error', e)
} }
document.querySelector('#clipboard').innerHTML = ''
} }
export const paste = ()=>{ export const paste = async () => {
document.querySelector('#clipboard').innerHTML = '<textarea id="clipboard-text"></textarea>' return new Promise((resolve) => {
document.querySelector('#clipboard-text').select() try {
document.execCommand('paste') navigator.clipboard.readText().then((text) => {
let r = document.querySelector('#clipboard-text').value || document.querySelector('#clipboard-text').innerHTML return resolve(text ? text : "")
document.querySelector('#clipboard').innerHTML = '' }).catch((e) => {
return r ? r : '' console.error(e)
return resolve("")
})
} catch {
resolve("")
}
});
} }
export const copyImage = (imageBase64,successCallback = "")=>{ export const copyImage = (imageBase64, successCallback = "") => {
if (isUtools && imageBase64){ if (imageBase64) {
window.utools.copyImage(imageBase64) try {
successCallback && successCallback() let arr = imageBase64.split(',')
let mime = arr[0].match(/:(.*?);/)[1];
let data = [new window.ClipboardItem({
[mime]: new Blob([Base64.toUint8Array(arr[1])], {type: mime})
})];
navigator.clipboard.write(data).then(function () {
successCallback && successCallback()
}, function (e) {
console.log('copy image failed', e)
});
} catch (e) {
console.log('copy image error', e)
}
} }
} }
......
...@@ -51,38 +51,74 @@ const debounceSaveToolDataMethod = _.debounce(function () { ...@@ -51,38 +51,74 @@ const debounceSaveToolDataMethod = _.debounce(function () {
return history(debounceSaveToolData['tool']).push(debounceSaveToolData['data']) return history(debounceSaveToolData['tool']).push(debounceSaveToolData['data'])
}, 1000) }, 1000)
const appendData = async function (field = "", check = "") {
const result = (data = "") => {
if (data){
if (
!check
|| (_.isFunction(check) && check(data)) // 函数校验
){
return field ? {[field]: data} : data
}
}
return field ? {} : ""
}
return new Promise(async (resolve) => {
try {
// 使用固定输入数据
if (fixeInputData) {
return resolve(result(fixeInputData))
}
if (setting.autoReadCopy()) {
let paste = (await clipboard.paste()).trim()
if (paste) {
resolve(result(paste))
}
}
resolve(result())
} catch {
resolve(result())
}
});
}
export const plugin = { export const plugin = {
install: function (Vue) { install: function (Vue) {
Vue.prototype.$getToolData = function (clipboardField = '',clipboardFieldRegex = "") { Vue.prototype.$initToolData = function (input = "", inputCheck = "", field = "current", isLoadHistory = true) {
let data = history(model.getCurrentTool()).current() let current = _.cloneDeep(this[field])
if (clipboardField) { if (isLoadHistory) {
let inputData = ""; Object.assign(current, this.$getToolData())
if (fixeInputData) { // 使用固定输入数据 }
inputData = fixeInputData if (!input) {
fixeInputData = "" this[field] = current
} else if (setting.autoReadCopy()) { return;
let paste = clipboard.paste() }
if (!data[clipboardField] && paste) {
if (setting.autoReadCopyFilter()) { // 初始化默认值
paste = paste.trim() if (!(input in current)){
} current[input] = "";
inputData = paste }
// 保存默认值
let inputDefault = current[input]
current[input] = "";
appendData(input, inputCheck).then((append) => {
for (let key of Object.keys(append)) {
if ((key in current) && !current[key]) {
current[key] = append[key]
} }
} }
if (inputData){ if (!current[input]){
if ( // 使用默认值
!(clipboardFieldRegex instanceof RegExp) current[input] = inputDefault
||
(
clipboardFieldRegex instanceof RegExp
&& clipboardFieldRegex.test(inputData)
)
){
data[clipboardField] = inputData
}
} }
} this[field] = current
return data })
}
Vue.prototype.$getToolData = function () {
return _.cloneDeep(history(model.getCurrentTool()).current())
} }
Vue.prototype.$saveToolData = function (data, ignoreDebounce = false) { Vue.prototype.$saveToolData = function (data, ignoreDebounce = false) {
if (ignoreDebounce) { if (ignoreDebounce) {
......
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
}, },
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
methods: { methods: {
handle() { handle() {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div> <div>
<div style="height: 250px;line-height: 250px;text-align: center;vertical-align: middle;"> <div style="height: 250px;line-height: 250px;text-align: center;vertical-align: middle;">
<canvas @click="saveImage" :style="`border: ${canvasBorder};vertical-align: middle;`" ref="barcode" <canvas @click="saveImage" :style="`border: ${canvasBorder};vertical-align: middle;`" ref="barcode"
class="barcode" v-show="!validStr"></canvas> class="barcode" v-show="!validStr" style="cursor:pointer"></canvas>
<p style="color: red" v-show="validStr">{{ validStr }}</p> <p style="color: red" v-show="validStr">{{ validStr }}</p>
</div> </div>
<div id="barcode-setting"> <div id="barcode-setting">
...@@ -146,7 +146,7 @@ import JsBarcode from 'jsbarcode' ...@@ -146,7 +146,7 @@ import JsBarcode from 'jsbarcode'
export default { export default {
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("text")) this.$initToolData('text')
}, },
computed: { computed: {
showText() { showText() {
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData('input')) this.$initToolData('input')
}, },
methods: { methods: {
handle(v) { handle(v) {
...@@ -52,10 +52,10 @@ export default { ...@@ -52,10 +52,10 @@ export default {
} }
else{ else{
this.current.output = Base64.decode(this.current.input) this.current.output = Base64.decode(this.current.input)
this.$clipboardCopy(this.current.output)
} }
} }
this.current.operation = v this.current.operation = v
this.$clipboardCopy(this.current.output)
this.$saveToolData(this.current) this.$saveToolData(this.current)
} }
}, },
...@@ -69,9 +69,9 @@ export default { ...@@ -69,9 +69,9 @@ export default {
}, },
exportFile() { exportFile() {
let arr = this.current.input.split(','), mime = arr[0].match(/:(.*?);/)[1]; let arr = this.current.input.split(','), mime = arr[0].match(/:(.*?);/)[1];
let objectUrl = window.URL.createObjectURL(new Blob([new Blob([Base64.toUint8Array(arr[1])], {type: mime})], {type: mime})); let objectUrl = window.URL.createObjectURL(new Blob([Base64.toUint8Array(arr[1])], {type: mime}));
let aEle = document.createElement("a"); let aEle = document.createElement("a");
aEle.download = `ctools-base64-decode-${moment().unix()}` + (mimeType.extension(mime) ? `.${mimeType.extension(mime)}` : ""); aEle.download = `ctool-base64-decode-${moment().unix()}` + (mimeType.extension(mime) ? `.${mimeType.extension(mime)}` : "");
aEle.href = objectUrl; aEle.href = objectUrl;
aEle.click(); aEle.click();
aEle.remove(); aEle.remove();
......
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
} }
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("content")) this.$initToolData('content')
}, },
methods: { methods: {
handle(language) { handle(language) {
......
...@@ -6,14 +6,15 @@ ...@@ -6,14 +6,15 @@
<span slot="prepend">{{ $t('crontab_expression') }}</span> <span slot="prepend">{{ $t('crontab_expression') }}</span>
</Input> </Input>
<heightResize :append="['.page-option-input']"> <heightResize :append="['.page-option-input']">
<autoHeightTextarea :value="output" :placeholder="$t('crontab_execute_time')" /> <autoHeightTextarea :value="output" :placeholder="$t('crontab_execute_time')"/>
</heightResize> </heightResize>
</Col> </Col>
<Col span="12" class="page-option-reference"> <Col span="12" class="page-option-reference">
<Tabs value="example"> <Tabs value="example">
<TabPane :label="$t('crontab_example')" name="example"> <TabPane :label="$t('crontab_example')" name="example">
<heightResize :reduce="52" @resize="resize"> <heightResize :reduce="52" @resize="resize">
<Table stripe size="small" :height="referenceHeight" border :columns="example.columns" :data="example.data"></Table> <Table stripe size="small" :height="referenceHeight" border :columns="example.columns"
:data="example.data"></Table>
</heightResize> </heightResize>
</TabPane> </TabPane>
<TabPane :label="$t('crontab_format')" name="format" style="text-align: center"> <TabPane :label="$t('crontab_format')" name="format" style="text-align: center">
...@@ -35,6 +36,7 @@ import moment from "moment" ...@@ -35,6 +36,7 @@ import moment from "moment"
import {getCurrentLocale} from "../../i18n"; import {getCurrentLocale} from "../../i18n";
import heightResize from "./components/heightResize"; import heightResize from "./components/heightResize";
import autoHeightTextarea from "./components/autoHeightTextarea"; import autoHeightTextarea from "./components/autoHeightTextarea";
export default { export default {
components: { components: {
heightResize, heightResize,
...@@ -63,7 +65,14 @@ export default { ...@@ -63,7 +65,14 @@ export default {
}, },
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData('input', (data) => {
try {
cronstrue.toString(data)
} catch {
return false
}
return true
})
this.example.data = this.example.data.map((item) => { this.example.data = this.example.data.map((item) => {
return { return {
example: item, example: item,
...@@ -75,16 +84,15 @@ export default { ...@@ -75,16 +84,15 @@ export default {
conversion(input) { conversion(input) {
return cronstrue.toString(input, {locale: this.locale}) return cronstrue.toString(input, {locale: this.locale})
}, },
resize(height){ resize(height) {
this.referenceHeight = height this.referenceHeight = height
} }
}, },
data() { data() {
return { return {
referenceHeight:101, referenceHeight: 101,
current: { current: {
input: "2 */5 * * 2-5", input: "2 */5 * * 2-5"
operation: "check"
}, },
special: { special: {
columns: [ columns: [
......
...@@ -42,7 +42,7 @@ import Radix from './library/radix.js' ...@@ -42,7 +42,7 @@ import Radix from './library/radix.js'
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@"; const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@";
export default { export default {
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
watch: { watch: {
convert: function (val) { convert: function (val) {
......
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
} }
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
methods: { methods: {
setLanguage(lang) { setLanguage(lang) {
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
handle(v) { handle(v) {
......
...@@ -21,7 +21,7 @@ import crypto from "crypto-js" ...@@ -21,7 +21,7 @@ import crypto from "crypto-js"
const sm = require('sm-crypto'); const sm = require('sm-crypto');
export default { export default {
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
computed: { computed: {
md5() { md5() {
......
...@@ -25,7 +25,7 @@ export default { ...@@ -25,7 +25,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
handle(type) { handle(type) {
......
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
handle(v) { handle(v) {
......
...@@ -32,7 +32,12 @@ export default { ...@@ -32,7 +32,12 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input',(input)=>{
return (
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(input)
|| input === "localhost"
)
})
}, },
methods: { methods: {
handle() { handle() {
......
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData('content')) this.$initToolData('content')
}, },
methods: { methods: {
handle(v) { handle(v) {
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
</Input> </Input>
</option-block> </option-block>
</div> </div>
<input-block top="10px" right="10px" :text="$t('jsonToObject_format')" @on-default-right-bottom-click="format"> <input-block top="10px" right="10px" :text="$t('jsonToObject_format')"
@on-default-right-bottom-click="format">
<heightResize :append="['.page-option-block']"> <heightResize :append="['.page-option-block']">
<code-editor v-model="current.input" :placeholder="$t('jsonToObject_input')" language="json"/> <code-editor v-model="current.input" :placeholder="$t('jsonToObject_input')" language="json"/>
</heightResize> </heightResize>
...@@ -22,7 +23,8 @@ ...@@ -22,7 +23,8 @@
<Col span="14"> <Col span="14">
<input-block top="10px" right="10px"> <input-block top="10px" right="10px">
<heightResize> <heightResize>
<code-editor :placeholder="$t('jsonToObject_output')" :value="output" :language="languages[current.type]"/> <code-editor :placeholder="$t('jsonToObject_output')" :value="output"
:language="languages[current.type]"/>
</heightResize> </heightResize>
<template slot="extra"> <template slot="extra">
<RadioGroup v-model="current.type" type="button" button-style="solid"> <RadioGroup v-model="current.type" type="button" button-style="solid">
...@@ -50,7 +52,14 @@ export default { ...@@ -50,7 +52,14 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData('input', (input) => {
try {
require('jsonlint').parse(input)
} catch (e) {
return false
}
return true
})
}, },
computed: { computed: {
output() { output() {
...@@ -82,13 +91,13 @@ export default { ...@@ -82,13 +91,13 @@ export default {
return this.$t('jsonToObject_error', [error.message]).toString() return this.$t('jsonToObject_error', [error.message]).toString()
} }
}, },
types(){ types() {
return Object.keys(this.languages) return Object.keys(this.languages)
} }
}, },
methods:{ methods: {
format(){ format() {
if (this.current.input.trim()){ if (this.current.input.trim()) {
this.current.input = jsonFormatter.beautify(this.current.input) this.current.input = jsonFormatter.beautify(this.current.input)
} }
} }
......
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
computed: { computed: {
output() { output() {
......
...@@ -49,7 +49,7 @@ export default { ...@@ -49,7 +49,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign({}, this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
computed: { computed: {
output() { output() {
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<Col span="14"> <Col span="14">
<Input v-model="current.generateInput" :rows="14" type="textarea" :placeholder="$t('qrCode_generate_input')"></Input> <Input v-model="current.generateInput" :rows="14" type="textarea" :placeholder="$t('qrCode_generate_input')"></Input>
</Col> </Col>
<Col span="10"> <Col span="10" style="text-align: center;">
<div style="text-align: center" v-html="generateOutput"></div> <img v-if="generateOutput" @click="()=>$clipboardCopyImages(generateOutput)" style="width:300px;cursor:pointer" :src="generateOutput" />
</Col> </Col>
</Row> </Row>
</TabPane> </TabPane>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</input-block> </input-block>
<Input v-model="readerOutput" :rows="8" type="textarea" :placeholder="$t('qrCode_reader_output')"></Input> <Input v-model="readerOutput" :rows="8" type="textarea" :placeholder="$t('qrCode_reader_output')"></Input>
</Col> </Col>
<Col span="10" style="text-align: center" v-html="readerInputImg"></Col> <Col span="10" style="text-align: center" v-html="readerInputImg" />
</Row> </Row>
</TabPane> </TabPane>
</Tabs> </Tabs>
...@@ -61,13 +61,13 @@ export default { ...@@ -61,13 +61,13 @@ export default {
created() { created() {
let feature = model.getToolCurrentFeature('generate') let feature = model.getToolCurrentFeature('generate')
if (feature === 'generate') { if (feature === 'generate') {
this.current = Object.assign(this.current, this.$getToolData('generateInput'))
this.current.operation = feature; this.current.operation = feature;
this.$initToolData('generateInput')
} else if (feature === 'reader') { } else if (feature === 'reader') {
this.current = Object.assign(this.current, this.$getToolData('readerInput'))
this.current.operation = feature; this.current.operation = feature;
this.$initToolData('readerInput')
} else { } else {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
} }
}, },
methods: { methods: {
...@@ -81,8 +81,8 @@ export default { ...@@ -81,8 +81,8 @@ export default {
this.generateOutput = this.$t("qrCode_generate_error", [error]); this.generateOutput = this.$t("qrCode_generate_error", [error]);
return; return;
} }
this.$clipboardCopyImages(url) this.generateOutput = url
this.generateOutput = `<img style="width:300px" src="${url}" />`
this.$saveToolData(this.current) this.$saveToolData(this.current)
}) })
}, },
......
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
mounted() { mounted() {
if (!this.current.output){ if (!this.current.output){
......
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
computed: { computed: {
replaceContent(){ replaceContent(){
......
...@@ -38,7 +38,7 @@ export default { ...@@ -38,7 +38,7 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
computed: { computed: {
output() { output() {
......
...@@ -78,7 +78,7 @@ export default { ...@@ -78,7 +78,7 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
methods: { methods: {
sign() { sign() {
......
...@@ -147,7 +147,7 @@ export default { ...@@ -147,7 +147,7 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("content")) this.$initToolData('content')
}, },
computed: { computed: {
stat(){ stat(){
......
...@@ -61,7 +61,7 @@ import moment from 'moment' ...@@ -61,7 +61,7 @@ import moment from 'moment'
export default { export default {
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
computed: { computed: {
poor() { poor() {
......
...@@ -14,9 +14,15 @@ ...@@ -14,9 +14,15 @@
</Button> </Button>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
<DropdownItem name="normalSecond">{{ $t('timestamp_normal_second') }}</DropdownItem> <DropdownItem name="normalSecond">{{ $t('timestamp_normal_second') }}</DropdownItem>
<DropdownItem name="normalMillisecond">{{ $t('timestamp_normal_millisecond') }}</DropdownItem> <DropdownItem name="normalMillisecond">{{
$t('timestamp_normal_millisecond')
}}
</DropdownItem>
<DropdownItem name="unixSecond">{{ $t('timestamp_unix_second') }}</DropdownItem> <DropdownItem name="unixSecond">{{ $t('timestamp_unix_second') }}</DropdownItem>
<DropdownItem name="unixMillisecond">{{ $t('timestamp_unix_millisecond') }}</DropdownItem> <DropdownItem name="unixMillisecond">{{
$t('timestamp_unix_millisecond')
}}
</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</template> </template>
...@@ -28,7 +34,10 @@ ...@@ -28,7 +34,10 @@
<span slot="prepend">{{ $t('timestamp_output') }}</span> <span slot="prepend">{{ $t('timestamp_output') }}</span>
</Input> </Input>
<template slot="extra"> <template slot="extra">
<Button size="small" type="primary" @click="()=>copy(output)">{{ $t('timestamp_copy') }}</Button> <Button size="small" type="primary" @click="()=>copy(output)">{{
$t('timestamp_copy')
}}
</Button>
</template> </template>
</input-block> </input-block>
</option-block> </option-block>
...@@ -57,10 +66,14 @@ export default { ...@@ -57,10 +66,14 @@ export default {
heightResize heightResize
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData('input')) this.$initToolData('input', (data) => {
if (!this.current.input) { return (
this.current.input = moment().format('YYYY-MM-DD HH:mm:ss') (new RegExp(/^\d+-\d+-\d+ \d+:\d+:\d+$/)).test(data)
} || (new RegExp(/^\d+-\d+-\d+ \d+:\d+:\d+\.\d+$/)).test(data)
|| (new RegExp(/^\d{10}$/)).test(data)
|| (new RegExp(/^\d{13}$/)).test(data)
)
})
}, },
mounted() { mounted() {
this.timer = setInterval(() => { this.timer = setInterval(() => {
...@@ -127,7 +140,7 @@ export default { ...@@ -127,7 +140,7 @@ export default {
}, },
methods: { methods: {
copy(data) { copy(data) {
if (data){ if (data) {
this.$clipboardCopy(data, true) this.$clipboardCopy(data, true)
} }
}, },
...@@ -147,7 +160,7 @@ export default { ...@@ -147,7 +160,7 @@ export default {
data() { data() {
return { return {
current: { current: {
input: '' input: moment().format('YYYY-MM-DD HH:mm:ss')
}, },
timer: null, timer: null,
timestamp: 0, timestamp: 0,
......
...@@ -36,7 +36,7 @@ export default { ...@@ -36,7 +36,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
handle(operation) { handle(operation) {
......
...@@ -21,7 +21,7 @@ export default { ...@@ -21,7 +21,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
handle(v) { handle(v) {
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
mounted() { mounted() {
if (this.current.result.length < 1){ if (this.current.result.length < 1){
......
...@@ -40,7 +40,7 @@ export default { ...@@ -40,7 +40,7 @@ export default {
} }
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData("input")) this.$initToolData('input')
}, },
methods: { methods: {
copy(type) { copy(type) {
......
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
autoHeightTextarea autoHeightTextarea
}, },
created() { created() {
this.current = Object.assign(this.current, this.$getToolData()) this.$initToolData()
}, },
methods: { methods: {
handle() { handle() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册