历史温度暂时提交
parent
72a71589b4
commit
620d031eb7
|
|
@ -2,7 +2,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="refresher-container">
|
<view class="refresher-container">
|
||||||
<!-- 这里的图片请换成自己项目的图片 -->
|
<!-- 这里的图片请换成自己项目的图片 -->
|
||||||
<image class="refresher-image" mode="aspectFit" src="@/static/refresher_loading.gif"></image>
|
<image class="refresher-image" mode="aspectFit" src="https://img.xiaoces.com/photos/refresher_loading.gif"></image>
|
||||||
<text class="refresher-text">{{statusText}}</text>
|
<text class="refresher-text">{{statusText}}</text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module.exports = {
|
||||||
// 应用版本
|
// 应用版本
|
||||||
version: "1.2.0",
|
version: "1.2.0",
|
||||||
// 应用logo
|
// 应用logo
|
||||||
logo: "/static/logo200.png",
|
logo: "https://img.xiaoces.com/photos/logo200.png",
|
||||||
// 官方网站
|
// 官方网站
|
||||||
site_url: "http://ruoyi.vip",
|
site_url: "http://ruoyi.vip",
|
||||||
// 政策协议
|
// 政策协议
|
||||||
|
|
|
||||||
2
main.js
2
main.js
|
|
@ -8,6 +8,8 @@ import { getDicts } from "@/api/system/dict/data"
|
||||||
import "./utils/uni.css";
|
import "./utils/uni.css";
|
||||||
// 引入全局TuniaoUI
|
// 引入全局TuniaoUI
|
||||||
import TuniaoUI from 'tuniao-ui'
|
import TuniaoUI from 'tuniao-ui'
|
||||||
|
import VueCompositionAPI from '@vue/composition-api'
|
||||||
|
Vue.use(VueCompositionAPI)
|
||||||
// 引入TuniaoUI提供的vuex简写方法
|
// 引入TuniaoUI提供的vuex简写方法
|
||||||
let vuexStore = require('@/store/$tn.mixin.js')
|
let vuexStore = require('@/store/$tn.mixin.js')
|
||||||
Vue.use(plugins)
|
Vue.use(plugins)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
|
"echarts": "^5.3.0",
|
||||||
"mqtt": "^2.18.8"
|
"mqtt": "^2.18.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
pages.json
12
pages.json
|
|
@ -27,6 +27,12 @@
|
||||||
"navigationBarTitleText": "数据中心"
|
"navigationBarTitleText": "数据中心"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// "path": "pages/data/indexDemo",
|
||||||
|
// "style": {
|
||||||
|
// "navigationBarTitleText": "数据中心11"
|
||||||
|
// }
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
"path": "pages/news/index",
|
"path": "pages/news/index",
|
||||||
"style": {
|
"style": {
|
||||||
|
|
@ -181,6 +187,12 @@
|
||||||
"selectedIconPath": "static/images/tabbar/data_.png",
|
"selectedIconPath": "static/images/tabbar/data_.png",
|
||||||
"text": "历史数据"
|
"text": "历史数据"
|
||||||
},
|
},
|
||||||
|
// {
|
||||||
|
// "pagePath": "pages/data/indexDemo",
|
||||||
|
// "iconPath": "static/images/tabbar/data.png",
|
||||||
|
// "selectedIconPath": "static/images/tabbar/data_.png",
|
||||||
|
// "text": "历史数据"
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
"pagePath": "pages/news/index",
|
"pagePath": "pages/news/index",
|
||||||
"iconPath": "static/images/tabbar/news.png",
|
"iconPath": "static/images/tabbar/news.png",
|
||||||
|
|
|
||||||
|
|
@ -8,14 +8,12 @@
|
||||||
|
|
||||||
</uni-col>
|
</uni-col>
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<uni-datetime-picker v-model="dateRange" type="datetimerange" @change="changeDate"/>
|
<uni-datetime-picker v-model="dateRange" type="datetimerange" :end="end" @change="changeDate"/>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<qiun-data-charts
|
<qiun-data-charts
|
||||||
type="line"
|
type="line"
|
||||||
:opts="opts"
|
:opts="opts"
|
||||||
|
|
@ -36,7 +34,7 @@
|
||||||
import { getHistoryData} from "../../api/system/data";
|
import { getHistoryData} from "../../api/system/data";
|
||||||
import {listAgri} from "../../api/system/assets/agri";
|
import {listAgri} from "../../api/system/assets/agri";
|
||||||
import store from "../../store";
|
import store from "../../store";
|
||||||
import {parseTime} from "../../utils/agri";
|
import {parseTime,isIntervalMoreThanNDays} from "../../utils/agri";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: function () {
|
data: function () {
|
||||||
|
|
@ -167,7 +165,10 @@ export default {
|
||||||
},
|
},
|
||||||
changeDate(date) {
|
changeDate(date) {
|
||||||
// date[0]-date[1]
|
// date[0]-date[1]
|
||||||
console.info("日期选择器:",date)
|
if (isIntervalMoreThanNDays(date[0],date[1],7)) {
|
||||||
|
this.$modal.alert('时间范围暂不支持查询超过7天以上的数据!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (date[0] === date[1]) {
|
if (date[0] === date[1]) {
|
||||||
this.dateRange[0] = parseTime(date[0], '{y}-{m}-{d} 00:00:00')
|
this.dateRange[0] = parseTime(date[0], '{y}-{m}-{d} 00:00:00')
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ export default {
|
||||||
"value": 1,
|
"value": 1,
|
||||||
"text": "设备编号",
|
"text": "设备编号",
|
||||||
}],
|
}],
|
||||||
imageSrc:'/static/agri.png',
|
imageSrc:'https://img.xiaoces.com/photos/agri.png',
|
||||||
scrollHeight: 0,
|
scrollHeight: 0,
|
||||||
// horizontal: 'right',
|
// horizontal: 'right',
|
||||||
// vertical: 'bottom',
|
// vertical: 'bottom',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="about-container">
|
<view class="about-container">
|
||||||
<view class="header-section text-center">
|
<view class="header-section text-center">
|
||||||
<image style="width: 160rpx;height: 160rpx;" src="/static/logo200.png" mode="widthFix">
|
<image style="width: 160rpx;height: 160rpx;" src="https://img.xiaoces.com/photos/logo200.png" mode="widthFix">
|
||||||
</image>
|
</image>
|
||||||
<uni-title type="h2" title="智能农业移动端"></uni-title>
|
<uni-title type="h2" title="智能农业移动端"></uni-title>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export default {
|
||||||
{
|
{
|
||||||
id: 1,
|
id: 1,
|
||||||
sender: '系统通知',
|
sender: '系统通知',
|
||||||
avatar: '/static/news.png',
|
avatar: 'https://img.xiaoces.com/photos/news.png',
|
||||||
preview: '您有一条新的系统通知,请查看',
|
preview: '您有一条新的系统通知,请查看',
|
||||||
time: '10:30',
|
time: '10:30',
|
||||||
unread: true,
|
unread: true,
|
||||||
|
|
@ -71,7 +71,7 @@ export default {
|
||||||
{
|
{
|
||||||
id: 2,
|
id: 2,
|
||||||
sender: '告警中心',
|
sender: '告警中心',
|
||||||
avatar: '/static/alarm.png',
|
avatar: 'https://img.xiaoces.com/photos/alarm.png',
|
||||||
preview: '您有一条新告警->',
|
preview: '您有一条新告警->',
|
||||||
time: '昨天',
|
time: '昨天',
|
||||||
unread: false,
|
unread: false,
|
||||||
|
|
@ -80,7 +80,7 @@ export default {
|
||||||
{
|
{
|
||||||
id: 3,
|
id: 3,
|
||||||
sender: '客服小美',
|
sender: '客服小美',
|
||||||
avatar: '/static/cs.png',
|
avatar: 'https://img.xiaoces.com/photos/cs.png',
|
||||||
preview: '您好,请问有什么可以帮到您的吗?',
|
preview: '您好,请问有什么可以帮到您的吗?',
|
||||||
time: '昨天',
|
time: '昨天',
|
||||||
unread: false,
|
unread: false,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="<%= BASE_URL %>static/favicon.ico">
|
<link rel="shortcut icon" type="image/x-icon" href="https://img.xiaoces.com/photos/favicon.ico">
|
||||||
<script>
|
<script>
|
||||||
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||||
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
|
@ -17,4 +17,5 @@
|
||||||
<strong>本站点必须要开启JavaScript才能运行.</strong>
|
<strong>本站点必须要开启JavaScript才能运行.</strong>
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -64,13 +64,12 @@ const cfu = {
|
||||||
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
|
"xAxisDemo2":function(val, index, opts){return formatDateTime(val,'h:m')},
|
||||||
"seriesDemo1":function(val, index, series, opts){return val+'元'},
|
"seriesDemo1":function(val, index, series, opts){return val+'元'},
|
||||||
"tooltipDemo":function(item, category, index, opts){
|
"tooltipDemo":function(item, category, index, opts){
|
||||||
if(index!==0) {
|
|
||||||
var unit = "%RH";
|
var unit = "%RH";
|
||||||
if (item.name.includes("温度")) {
|
if (item.name.includes("温度")) {
|
||||||
unit = "℃";
|
unit = "℃";
|
||||||
}
|
}
|
||||||
return `${item.name}: ${item.data} ${unit}`
|
return `${item.name}: ${item.data} ${unit}`
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"tooltipDemo1":function(item, category, index, opts){
|
"tooltipDemo1":function(item, category, index, opts){
|
||||||
if(index==0){
|
if(index==0){
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,39 @@ export function checkTimeConflict(list) {
|
||||||
return { isConflict: false };
|
return { isConflict: false };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断两个时间的间隔是否大于 N 天
|
||||||
|
* @param {Date|String} time1 第一个时间
|
||||||
|
* @param {Date|String} time2 第二个时间
|
||||||
|
* @param {Number} days 天数
|
||||||
|
* @returns {Boolean} true=间隔大于N天;false=不大于
|
||||||
|
*/
|
||||||
|
export function isIntervalMoreThanNDays(time1, time2, days) {
|
||||||
|
// 转换并校验时间
|
||||||
|
const d1 = new Date(time1);
|
||||||
|
const d2 = new Date(time2);
|
||||||
|
if (isNaN(d1.getTime()) || isNaN(d2.getTime())) {
|
||||||
|
throw new Error("时间格式不合法!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算两个时间的毫秒差(取绝对值,避免顺序问题)
|
||||||
|
const timeDiff = Math.abs(d1.getTime() - d2.getTime());
|
||||||
|
const oneDayMs = 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
|
// 转换为天数并比较
|
||||||
|
const dayDiff = timeDiff / oneDayMs;
|
||||||
|
return dayDiff > days;
|
||||||
|
}
|
||||||
|
|
||||||
|
// // 测试示例
|
||||||
|
// const start = "2026-03-01";
|
||||||
|
// const end = "2026-03-12";
|
||||||
|
// console.log(isIntervalMoreThanNDays(start, end, 10)); // true(间隔11天,大于10天)
|
||||||
|
// console.log(isIntervalMoreThanNDays(start, end, 11)); // false(刚好11天,不大于)
|
||||||
|
|
||||||
// ===================== 测试用例 =====================
|
// ===================== 测试用例 =====================
|
||||||
/*
|
/*
|
||||||
const rollerList = [
|
const rollerList = [
|
||||||
|
|
|
||||||
|
|
@ -1,82 +0,0 @@
|
||||||
import Vue from 'vue'
|
|
||||||
import { mergeRecursive } from "@/utils/agri"
|
|
||||||
import DictMeta from './DictMeta'
|
|
||||||
import DictData from './DictData'
|
|
||||||
|
|
||||||
const DEFAULT_DICT_OPTIONS = {
|
|
||||||
types: [],
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc 字典
|
|
||||||
* @property {Object} label 标签对象,内部属性名为字典类型名称
|
|
||||||
* @property {Object} dict 字段数组,内部属性名为字典类型名称
|
|
||||||
* @property {Array.<DictMeta>} _dictMetas 字典元数据数组
|
|
||||||
*/
|
|
||||||
export default class Dict {
|
|
||||||
constructor() {
|
|
||||||
this.owner = null
|
|
||||||
this.label = {}
|
|
||||||
this.type = {}
|
|
||||||
}
|
|
||||||
|
|
||||||
init(options) {
|
|
||||||
if (options instanceof Array) {
|
|
||||||
options = { types: options }
|
|
||||||
}
|
|
||||||
const opts = mergeRecursive(DEFAULT_DICT_OPTIONS, options)
|
|
||||||
if (opts.types === undefined) {
|
|
||||||
throw new Error('need dict types')
|
|
||||||
}
|
|
||||||
const ps = []
|
|
||||||
this._dictMetas = opts.types.map(t => DictMeta.parse(t))
|
|
||||||
this._dictMetas.forEach(dictMeta => {
|
|
||||||
const type = dictMeta.type
|
|
||||||
Vue.set(this.label, type, {})
|
|
||||||
Vue.set(this.type, type, [])
|
|
||||||
if (dictMeta.lazy) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
ps.push(loadDict(this, dictMeta))
|
|
||||||
})
|
|
||||||
return Promise.all(ps)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 重新加载字典
|
|
||||||
* @param {String} type 字典类型
|
|
||||||
*/
|
|
||||||
reloadDict(type) {
|
|
||||||
const dictMeta = this._dictMetas.find(e => e.type === type)
|
|
||||||
if (dictMeta === undefined) {
|
|
||||||
return Promise.reject(`the dict meta of ${type} was not found`)
|
|
||||||
}
|
|
||||||
return loadDict(this, dictMeta)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 加载字典
|
|
||||||
* @param {Dict} dict 字典
|
|
||||||
* @param {DictMeta} dictMeta 字典元数据
|
|
||||||
* @returns {Promise}
|
|
||||||
*/
|
|
||||||
function loadDict(dict, dictMeta) {
|
|
||||||
return dictMeta.request(dictMeta)
|
|
||||||
.then(response => {
|
|
||||||
const type = dictMeta.type
|
|
||||||
let dicts = dictMeta.responseConverter(response, dictMeta)
|
|
||||||
if (!(dicts instanceof Array)) {
|
|
||||||
console.error('the return of responseConverter must be Array.<DictData>')
|
|
||||||
dicts = []
|
|
||||||
} else if (dicts.filter(d => d instanceof DictData).length !== dicts.length) {
|
|
||||||
console.error('the type of elements in dicts must be DictData')
|
|
||||||
dicts = []
|
|
||||||
}
|
|
||||||
dict.type[type].splice(0, Number.MAX_SAFE_INTEGER, ...dicts)
|
|
||||||
dicts.forEach(d => {
|
|
||||||
Vue.set(dict.label[type], d.value, d.label)
|
|
||||||
})
|
|
||||||
return dicts
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import DictOptions from './DictOptions'
|
|
||||||
import DictData from './DictData'
|
|
||||||
|
|
||||||
export default function(dict, dictMeta) {
|
|
||||||
const label = determineDictField(dict, dictMeta.labelField, ...DictOptions.DEFAULT_LABEL_FIELDS)
|
|
||||||
const value = determineDictField(dict, dictMeta.valueField, ...DictOptions.DEFAULT_VALUE_FIELDS)
|
|
||||||
return new DictData(dict[label], dict[value], dict)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 确定字典字段
|
|
||||||
* @param {DictData} dict
|
|
||||||
* @param {...String} fields
|
|
||||||
*/
|
|
||||||
function determineDictField(dict, ...fields) {
|
|
||||||
return fields.find(f => Object.prototype.hasOwnProperty.call(dict, f))
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* @classdesc 字典数据
|
|
||||||
* @property {String} label 标签
|
|
||||||
* @property {*} value 标签
|
|
||||||
* @property {Object} raw 原始数据
|
|
||||||
*/
|
|
||||||
export default class DictData {
|
|
||||||
constructor(label, value, raw) {
|
|
||||||
this.label = label
|
|
||||||
this.value = value
|
|
||||||
this.raw = raw
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
import { mergeRecursive } from "@/utils/agri"
|
|
||||||
import DictOptions from './DictOptions'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc 字典元数据
|
|
||||||
* @property {String} type 类型
|
|
||||||
* @property {Function} request 请求
|
|
||||||
* @property {String} label 标签字段
|
|
||||||
* @property {String} value 值字段
|
|
||||||
*/
|
|
||||||
export default class DictMeta {
|
|
||||||
constructor(options) {
|
|
||||||
this.type = options.type
|
|
||||||
this.request = options.request
|
|
||||||
this.responseConverter = options.responseConverter
|
|
||||||
this.labelField = options.labelField
|
|
||||||
this.valueField = options.valueField
|
|
||||||
this.lazy = options.lazy === true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 解析字典元数据
|
|
||||||
* @param {Object} options
|
|
||||||
* @returns {DictMeta}
|
|
||||||
*/
|
|
||||||
DictMeta.parse= function(options) {
|
|
||||||
let opts = null
|
|
||||||
if (typeof options === 'string') {
|
|
||||||
opts = DictOptions.metas[options] || {}
|
|
||||||
opts.type = options
|
|
||||||
} else if (typeof options === 'object') {
|
|
||||||
opts = options
|
|
||||||
}
|
|
||||||
opts = mergeRecursive(DictOptions.metas['*'], opts)
|
|
||||||
return new DictMeta(opts)
|
|
||||||
}
|
|
||||||
|
|
@ -1,51 +0,0 @@
|
||||||
import { mergeRecursive } from "@/utils/agri"
|
|
||||||
import dictConverter from './DictConverter'
|
|
||||||
|
|
||||||
export const options = {
|
|
||||||
metas: {
|
|
||||||
'*': {
|
|
||||||
/**
|
|
||||||
* 字典请求,方法签名为function(dictMeta: DictMeta): Promise
|
|
||||||
*/
|
|
||||||
request: (dictMeta) => {
|
|
||||||
console.log(`load dict ${dictMeta.type}`)
|
|
||||||
return Promise.resolve([])
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 字典响应数据转换器,方法签名为function(response: Object, dictMeta: DictMeta): DictData
|
|
||||||
*/
|
|
||||||
responseConverter,
|
|
||||||
labelField: 'label',
|
|
||||||
valueField: 'value',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 默认标签字段
|
|
||||||
*/
|
|
||||||
DEFAULT_LABEL_FIELDS: ['label', 'name', 'title'],
|
|
||||||
/**
|
|
||||||
* 默认值字段
|
|
||||||
*/
|
|
||||||
DEFAULT_VALUE_FIELDS: ['value', 'id', 'uid', 'key'],
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 映射字典
|
|
||||||
* @param {Object} response 字典数据
|
|
||||||
* @param {DictMeta} dictMeta 字典元数据
|
|
||||||
* @returns {DictData}
|
|
||||||
*/
|
|
||||||
function responseConverter(response, dictMeta) {
|
|
||||||
const dicts = response.content instanceof Array ? response.content : response
|
|
||||||
if (dicts === undefined) {
|
|
||||||
console.warn(`no dict data of "${dictMeta.type}" found in the response`)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
return dicts.map(d => dictConverter(d, dictMeta))
|
|
||||||
}
|
|
||||||
|
|
||||||
export function mergeOptions(src) {
|
|
||||||
mergeRecursive(options, src)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default options
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
import Dict from './Dict'
|
|
||||||
import { mergeOptions } from './DictOptions'
|
|
||||||
|
|
||||||
export default function(Vue, options) {
|
|
||||||
mergeOptions(options)
|
|
||||||
Vue.mixin({
|
|
||||||
data() {
|
|
||||||
if (this.$options === undefined || this.$options.dicts === undefined || this.$options.dicts === null) {
|
|
||||||
return {}
|
|
||||||
}
|
|
||||||
const dict = new Dict()
|
|
||||||
dict.owner = this
|
|
||||||
return {
|
|
||||||
dict
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
if (!(this.dict instanceof Dict)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
options.onCreated && options.onCreated(this.dict)
|
|
||||||
this.dict.init(this.$options.dicts).then(() => {
|
|
||||||
options.onReady && options.onReady(this.dict)
|
|
||||||
this.$nextTick(() => {
|
|
||||||
this.$emit('dictReady', this.dict)
|
|
||||||
if (this.$options.methods && this.$options.methods.onDictReady instanceof Function) {
|
|
||||||
this.$options.methods.onDictReady.call(this, this.dict)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue