小编sib*_*ibi的帖子

React js做公共标题

我是新的反应js,我需要做标题常见,需要根据路线变化更改标题.我需要创建header.jsx文件并导入它吗?或者如何用路由呈现标题(公共文件)?我的路由部分看起来像这样.

import React from 'react';
import ReactDOM from 'react-dom';
import App from './App.jsx';
import Home from './Home.jsx';
import { Router, Route, Link, browserHistory, IndexRoute  } from 'react-router';

ReactDOM.render((
    <Router history = {browserHistory}>
        <Route path = "/home" component = {Home} />
        <Route path = "/" component = {App}>
        </Route>
    </Router>
));
Run Code Online (Sandbox Code Playgroud)

reactjs react-router react-native

12
推荐指数
1
解决办法
3万
查看次数

Python 图像保存错误 - 从 e ValueError: 未知文件扩展名引发 ValueError("未知文件扩展名: {}".format(ext))

我刚刚有了四个星期的 Python 经验。使用 Tkinter 创建一个工具,将新的公司徽标粘贴到现有图像上。

下面的方法是获取给定目录中的所有图像并将新徽标粘贴到初始级别。现有图像、编辑图像、x 位置、y 位置、图像预览和少量数据存储在全局实例self.images_all_arr中。

def get_img_copy(self):
    self.images_all_arr = []
    existing_img_fldr = self.input_frame.input_frame_data['existing_img_folder']
    for file in os.listdir(existing_img_fldr):
        img_old = Image.open(os.path.join(existing_img_fldr, file))
        img_new_copy = img_old.copy()
        self.pasteImage(img_new_copy, initpaste=True) #process to paste new logo.
        view_new_img = ImageTk.PhotoImage(img_new_copy)
        fname, fext = file.split('.')
        formObj = {
            "fname": fname,
            "fext": fext,
            "img_old": img_old,
            "img_new": img_new_copy,
            "img_new_view": view_new_img,
            "add_logo": 1,
            "is_default": 1,
            "is_opacityImg": 0,
            "pos_x": self.defult_x.get(),
            "pos_y": self.defult_y.get()
        }
        self.images_all_arr.append(formObj)
Run Code Online (Sandbox Code Playgroud)

在 Tkinter 屏幕中预览每个图像后,根据需要对位置 x 和 y 进行一些调整(更新列表self.images_all_arr中的 pos_x 和 pos_y )。 …

python-imaging-library python-3.x os.path

3
推荐指数
1
解决办法
3万
查看次数

css line-height:数字到px

我正在做一个自动化工具,必须选择html css属性(字体颜色,大小等..),并完成大部分的部分.这里的问题是,有些情况下我得到了css属性(行高),行高:1.54.这里出于某种目的,我需要将数字(1.54)转换为px值(例如,行高:15px).那么,有可能进行这种计算吗?

html javascript css

0
推荐指数
1
解决办法
2897
查看次数