本来是一个后台开发,这两年小程序太火了,最近尝试了一下小程序,发现入门挺简单的,像我这种没有一点前端开发经验的在网上搜点资料,花一天左右就能开发个简单的小程序。以上只是我开发小程序过程的一些感想,今天重点是想分享一下学到新知识——矢量图在小程序的应用
wxss文件:
@font-face {font-family: "iconfont"; src: url('iconfont.eot?t=1558448748981'); /* IE9 */ src: url('iconfont.eot?t=1558448748981#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAAKMAAsAAAAABkgAAAJCAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHEIGVgCCcApUZQE2AiQDCAsGAAQgBYRtBzAbiwXILrBt2JNAhQIKTYL7Y8GDAPHwtR/7c3cX1aSaGKJoVskkhlC8kiAGK+lbFw39Lb9f24mXsn7n0QQ8ef6y98X3hyU8hQuJVKCZhEakcaJY9SUBwFcpBClwOO0CBXIHlNs9h88FTDDA8x5FViChN4xd8AKPE2g0oCGzub57AGWFPS4QV46lQbngUxSWrBdqG5YW8aJGfXpKj3iOvh//zEeZpCazy3Yu10yY/lxz0vJj9dhFQOAnoNU1yJgDCnHQGNuSE4yW07g+bwQoiuDnqsIGcVStYH+dXdgM+mA8+NkTPGphAiVJdAFjmFquTc11N8/fDz79OPzy6/jzz4vGfDA+rg3lrr5BzH84miH0RdmE1dM8Pr68Zb2fCV7z6v9ti//lWgHf1P1oRPUI8iPqd2MPfgd/YEsxhLY+FY3f6Ei6Jo1NaNSICnZ1+p2q6jl3KtTruQNHnf7MktXrfEgs1DnUaLKAWvVW0GjWxuomXVhOlAbMuAcI7R6QtPpA1u6JWKg/qNHrD7XaI4dGR9G1ZZOJcKobTJqQifoFOkYUKtco1bh4j6wTX+O8MKIfEadOELutTjm5QSHxEjPSU6snolBxFOA6OI18P8KYI5cMadkicb/dVk1vahlRAFUbGNEIYkK6C8hhiIRU0F1UK5/fQywnfBruqKhzHiEs5fSOulo6A4gbsnBQxaO8kjpl6RFCQQqLBNA6GER8vgiKmwe5iEG02BMisb6200kNlbW2VwQ/kMtqsNUpnH5Z7fVJoBMDAA==') format('woff2'), url('iconfont.woff?t=1558448748981') format('woff'), url('iconfont.ttf?t=1558448748981') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+ */ url('iconfont.svg?t=1558448748981#iconfont') format('svg'); /* iOS 4.1- */ } .iconfont { font-family: "iconfont" !important; font-size: 16px; font-style: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .icon-number:before { content: "\e641"; } /* 注意:上面是拷贝的iconfont.css文件全部代码,下面是自己设置的button属性 */ .cubtn { position: relative; border: 0rpx; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 0 30rpx; font-size: 28rpx; height: 64rpx; line-height: 1; text-align: center; text-decoration: none; overflow: visible; margin-left: initial; transform: translate(0rpx, 0rpx); margin-right: initial; left: 40vw; } .cubtn::after{ display: none; } .cubtn.icon{ width: 20vw; height: 20vw; border-radius: 500rpx; padding: 0; } .icon-number{ font-size:20vw; }wxml文件
<button class="cubtn icon"> <view class="iconfont icon-number"></view> </button>