默认导出一个RouteConfig数组

时间:2018-12-03 03:25:37

标签: typescript vue.js

是否可以“合并”“ algo”声明和导出默认值?

例如。我有这段代码:

A_init= 4; 
B_init= 1.1;
C_init= 4;
y0 = [A_init; B_init; C_init];
h = 20/100;
n = 100;
t0 = 0;
tf = 20;
t = linspace(t0,tf,n);
y = zeros(numel(y0) , n); 
y(:, 1) = y0(:);

dAdt= @(a,b) 7.27*(b-a*b+ a-(8.375*10^-5)*a^3);
dBdt= @(b,a,c)(-b-a*b+c)/77.27;
dCdt= @(c,a) 0.4*(a-c);

for i = 1:n-1
    y(1,i+1) = y(1,i) +h*feval(dAdt,y(1,i),y(2,i));
    y(3,i+1) = y(3,i) +h*feval(dCdt,y(3,i),y(1,i));
    y(2,i+1) = y(2,i) +h*feval(dBdt,y(2,i),y(1,i),y(3,i));
end

有没有办法做类似的事情?

import { HelloWorld } from './components';
import { RouteConfig } from 'vue-router';

let algo: RouteConfig[] = [
    {
        path: '/',
        name: 'home',
        component: HelloWorld
    }
]

export default algo;

1 个答案:

答案 0 :(得分:1)

  

有没有办法做类似的事情?

不。不幸的是,除非您要导出函数OR类,否则您需要将声明和export default语句分开。

我个人不太使用export defaulthttps://basarat.gitbooks.io/typescript/docs/tips/defaultIsBad.html