feat:use local data

This commit is contained in:
pengfei.zhou 2020-03-03 18:58:53 +08:00 committed by osborn
parent ef77d5ec95
commit 15ce9cb6ba
4 changed files with 1826 additions and 2 deletions

View File

@ -10,6 +10,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"@rollup/plugin-json": "^4.0.2",
"doric": "file:../doric-js",
"reflect-metadata": "^0.1.13",
"rollup": "^1.29.0",

View File

@ -4,6 +4,7 @@ import bundles from './build/index'
import fs from 'fs'
import path from 'path'
import buble from '@rollup/plugin-buble';
import json from "@rollup/plugin-json"
function readDirs(dirPath, files) {
if (fs.statSync(dirPath).isDirectory()) {
@ -49,6 +50,7 @@ export default
plugins: [
resolve({ mainFields: ["jsnext"] }),
commonjs(),
json(),
],
external: ['reflect-metadata', 'doric'],
onwarn: function (warning) {
@ -70,6 +72,7 @@ export default
plugins: [
resolve({ mainFields: ["jsnext"] }),
commonjs(),
json(),
buble({
transforms: { dangerousForOf: true }
}),

View File

@ -1,5 +1,6 @@
import { Group, text, gravity, Color, LayoutSpec, vlayout, hlayout, layoutConfig, scroller, Text, ViewHolder, VMPanel, ViewModel, network, loge, HLayout, stack, image, Gravity, takeNonNull, Scroller, Image } from "doric";
import { colors } from "./utils";
import MovieData from './movie.json'
interface DoubanModel {
count: number
@ -16,7 +17,7 @@ interface DoubanModel {
"4": number,
"5": number,
},
stars: number
stars: string
min: number,
}
genres: string[],
@ -204,7 +205,7 @@ class SliderPanel extends VMPanel<MovieModel, MovieVH>{
}
getState() {
return { selectedIdx: 0 }
return { selectedIdx: 0, doubanModel: MovieData }
}
}

1819
doric-demo/src/movie.json Normal file

File diff suppressed because it is too large Load Diff